2010-11-10 25 views
2

我需要使用System.DirectoryServices類迭代組的成員。迭代活動目錄中大型組的成員

我看到的問題是,我獲得該組的DirectoryEntry後,「members」屬性只包含1500個條目。實際上,該組有4000多個。

是否有一些設置告訴DirectoryServices類未檢索到超過1500個組成員?

+0

這篇文章在MSDN上可能會有所幫助: http://support.microsoft.com/default.aspx?scid=kb;en-us;839424 – 2010-11-10 16:59:46

回答

3

如果可以,請嘗試使用.NET 3.5中的System.DirectoryServices.AccountManagement命名空間。我沒有任何一組相當大型試試 - 但你應該能夠得到這些成員:

PrincipalContext ctx = new PrincipalContext(ContextType.Domain); 

GroupPrincipal group = GroupPrincipal.FindByIdentity("name of the group"); 

if(group != null) 
{ 
    foreach(Principal p in group.Members) 
    { 
     // do something 
    } 
} 

你可以閱讀更多關於S.DS.AM命名空間,並在MSDN雜誌的新的能力: Managing Directory Security Principals in the .NET Framework 3.5