的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