有沒有辦法從對象模型中搜索MOSS中的配置文件?我需要搜索在他們的個人資料上設置了特定值的個人資料,然後爲他們執行一些操作。SharePoint用戶配置文件搜索
我需要編寫一些可以搜索配置文件數據庫並返回匹配配置文件的c#代碼。基本上,
列表的配置文件=選擇配置文件從配置文件存儲在哪裏配置文件屬性值= someValue中
我試圖避免以下:
private IEnumerable<UserProfile> SearchProfiles(string value) {
ServerContext serverContext = ServerContext.GetContext(SPContext.Current.Site);
UserProfileManager profileManager = new UserProfileManager(serverContext);
foreach (UserProfile profile in profileManager) {
if ((string)profile["MyProp"].Value == value) {
yield return profile;
}
}
}
6年後,我知道,但爲什麼我不能在SPContext.Current.Site中使用RunWithElevatedPrivileges? – 2016-05-25 13:04:25