c# - 迭代事件目录中大型组的成员

标签 c# active-directory directoryservices

我需要使用 System.DirectoryServices 类迭代组的成员。

我看到的问题是,在获得该组的 DirectoryEntry 后,“members”属性仅包含 1500 个条目。事实上,该团体有超过 4000 人。

是否有一些设置告诉 DirectoryServices 类不要检索超过 1500 个组成员?

最佳答案

如果可以,请尝试使用 .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
    }
}

您可以在 MSDN 杂志上阅读有关 S.DS.AM 命名空间及其新功能的更多信息:Managing Directory Security Principals in the .NET Framework 3.5

关于c# - 迭代事件目录中大型组的成员,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4146902/

相关文章:

c# - .net 核心中的 System.DirectoryServices.AccountManagement

c# - 通过引用传递给静态方法的变量?

c# - 如何在 Visual Studio 中重命名 C# 类型?

c# - 正则表达式替换错误符号 C#

c# - 有没有一种方法可以在不提供任何 C# 信息的情况下在网络上找到 Active Directory?

c# - 如何解决 "The server does not support the control. The control is critical."Active Directory 错误

javascript - 如何使用 selenium 在 C# 中编辑 Web 元素属性值

c# - 使用 C# 将用户添加到 Active Directory 组时遇到问题

c# - 将 DirectoryEntry 转换为 PrincipalContext

c# - 如何在复杂环境中使用 FQDN 获取 NETBIOS 域名