Active Directory search RRS feed

  • Question

  • I am doing a directory search against a group with 1092 members. My code below only gets 1000 users. (I have a forest of domains)

    DirectoryEntry root = new DirectoryEntry("GC://dc=me,dc=com");
    DirectorySearcher searcher = new DirectorySearcher(root);
    searcher.ReferralChasing = ReferralChasingOption.All;
    searcher.Filter = "(&(objectClass=user)(memberOf=myGroup))";

    What am I doing wrong?

    Certified Geek

    • Edited by Arne MN Monday, May 4, 2015 1:22 PM
    Monday, May 4, 2015 1:20 PM


  • Sorry, I didn't read your post carefully and jumped to conclusions. Range retrieval would be required if you retrieved the member attribute of a group. Otherwise there is a limit to the number of values of a multivalued attribute that can be retrieved. But you are retrieving all objects with value for the memberOf attribute. There is no limit to the number of rows you can retrieve in the resultset.

    However, only 1000 rows will be retrieved if you do not enable paging. You do this by specifying any value for "Page Size" I find that a Page Size of 200 is most efficient in my domain with about 4000 objects. I just retrieved 1800 members of a group no problem with this Page Size. The syntax should be:

    $Searcher.PageSize = 200

    Sorry for the confusion. In the past the maximum page size allowed was 1000, but I think the limit is greater now.

    Richard Mueller - MVP Directory Services

    • Proposed as answer by Fred BaoModerator Tuesday, May 5, 2015 1:38 AM
    • Marked as answer by Arne MN Tuesday, May 5, 2015 11:54 AM
    Monday, May 4, 2015 8:57 PM

All replies