0
我在.NET 4.5中使用System.DirectoryServices.AccountManagement。Active Directory相關的搜索器組來自AccountManagement.Principal的屬性
我想從下面的代碼中獲取Active Directory中的所有組和屬性。但我有額外的屬性違抗作爲鍵值System.DirectoryServices.SearchResult,
我怎樣才能得到System.DirectoryServices.SearchResult下的所有屬性從System.DirectoryServices.AccountManagement.Principal
// create your domain context
var ctx = new PrincipalContext(ContextType.Domain, _domain, _userName, _password);
// define a "query-by-example" principal - here, we search for a GroupPrincipal
var groupPrincipal = new GroupPrincipal(ctx);
// create your principal searcher passing in the QBE principal
var searcher = new PrincipalSearcher(groupPrincipal);
foreach (var found in searcher.FindAll())
{
}