2011-12-07 34 views
0

我想用類似於S.DS.AccountManagement的東西檢索組織單元的所有屬性。使用S.DS.ActiveDirectory命名空間來枚舉OU屬性

由於S.DS.Accountmanagement僅適用於用戶和組,因此在這種情況下是否可以使用S.DS.ActiveDirectory命名空間?我還沒有找到很多使用S.DS.ActiveDirectory的例子。

回答

0
string LdapPath = @"LDAP://" + DomainServer.HostName + "." + domainName + "/" + strOuCn; 

DirectoryEntry adEntry = new DirectoryEntry(); 

adEntry.AuthenticationType = AuthenticationTypes.ServerBind; 
adEntry.Path = LdapPath; //loads OU to adEntry 

,那麼你可以檢查你的屬性,例如:

adEntry.Properties["distinguishedName"]