C#Active Directory查询结果限制

时间:2009-10-15 08:18:32

标签: c# active-directory

  

可能重复:
  Is the directorysearcher object capped at 5000 even if pagesize is set to greater

我正在对容器运行查询以确定它包含多少个对象:

DirectoryEntry entry = new DirectoryEntry("LDAP://CN=Users,DC=XXX,DC=YYY");
string filter = "(objectClass=Person)";
string[] properties = { "distinguishedName" };
DirectorySearcher search = new DirectorySearcher(entry, filter, properties, SearchScope.Subtree);
var results = search.FindAll();
foreach (SearchResult result in results) {
    Console.WriteLine(result.Path);
}
Console.WriteLine(results.Count);
entry.Close();

但是,即使我明确设置了不同的大小限制,查询也始终返回最多2000个对象:

search.SizeLimit = 10000; // useless

如何从查询中获取所有结果?

0 个答案:

没有答案