有没有办法从对象模型中搜索 MOSS 中的配置文件?我需要搜索在其个人资料上设置了特定值的个人资料,然后为它们执行一些操作。
我需要编写一些可以搜索配置文件数据库并返回匹配配置文件的 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;
}
}
}