2010-11-10 54 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