的Principal
类只有几个广告属性表示:如何使用广告属性不是在主体类
的问题是我需要阅读的属性,是不是在Principal
类。 ..
这是我如何查询AD对象:
// create your domain context
PrincipalContext ctx = new PrincipalContext(ContextType.Domain,ConfigurationManager.AppSettings["ADDomain"].ToString(), ConfigurationManager.AppSettings["ADUser"].ToString(), ConfigurationManager.AppSettings["ADPassword"].ToString());
// define a "query-by-example" principal - here, we search for all users
UserPrincipalEXT qbeUser = new UserPrincipalEXT(ctx);
// create your principal searcher passing in the QBE principal
PrincipalSearcher srch = new PrincipalSearcher(qbeUser);
// find all matches
foreach (var found in srch.FindAll()) //FOUND represent the AD object
{
...
}
有没有办法延长Principal
类获取更多AD属性?
真的很好的答案。谢谢!! – Shiva 2014-11-20 21:08:06