2012-11-08 20 views

回答

2

According to this,AD LDS角色是駐留在您的LDS實例的CN=Roles容器中的AD組 - 對嗎?

隨着在System.DirectoryServices.AccountManagement(S.DS.AM)命名空間中的類,你可以得到這些團體很容易:

// set up the "ApplicationDirectory" context and use the "CN=Roles" container 
PrincipalContext ctx = new PrincipalContext(ContextType.ApplicationDirectory, "ldsserver:389", "CN=Roles,DC=YourCompany,DC=com"); 

// set up a "QBE" group principal 
GroupPrincipal qbeGroup = new GroupPrincipal(ctx); 

// create your principal searcher passing in the QBE principal  
PrincipalSearcher srch = new PrincipalSearcher(qbeGroup); 

// find all matches 
foreach(var found in srch.FindAll()) 
{ 
    // do whatever here - "found" should be "GroupPrincipal" types only 
} 

閱讀所有關於System.DirectoryServices.AccountManagement(S.DS.AM)命名空間位置:

新的S.DS.AM可以很容易地與AD(和AD LDS)中的用戶和羣組玩耍!