我必须使用来自我的AD域中的所有人基于brililant ASPTokenInput填充我的自动完成PeopleEditor控件.反映PeopleEditor在他们的Active Directory搜索引擎中显示了一个真正的混乱,所有可能有用的类都是内部的.
我的测试方法工作正常,但我需要从AD(而不是sharepoint站点)的所有用户填充我的列表:
public string GetUsers(string filter)
{
var spWeb = SPContext.Current.Web;
SPUserCollection allusers = spWeb.AllUsers;
List<SPUser> users = allusers.Cast<SPUser>().ToList();
var query = from spUser in users.Select(usr => new {id = usr.ID, name = usr.Name})
.Where(p => p.name.IndexOf(filter, StringComparison.InvariantCultureIgnoreCase) >= 0)
select new {id = spUser.id.ToString(), spUser.name};
return new JavaScriptSerializer().Serialize(query);
}
Run Code Online (Sandbox Code Playgroud)
我该如何查询这样的活动目录?是否可以从sharepoint本身检索所有AD连接设置?我只需要id和用户名来填充我的下拉列表将此转换为SPUserCollection是另一个大问题.
使用像这样的内置SP方法会很棒:
[SubsetCallableExcludeMember(SubsetCallableExcludeMemberType.UnsupportedSPType)]
public static IList<SPPrincipalInfo> SearchWindowsPrincipals(SPWebApplication webApp, string input, SPPrincipalType scopes, int maxCount, out bool reachMaxCount)
Run Code Online (Sandbox Code Playgroud)