Is the directorysearcher object capped at 5000 even if pagesize is set to greater

前端 未结 3 874
抹茶落季
抹茶落季 2020-12-21 09:49

Is the directorysearcher findall results method capped at 5000 results even if pagesize is set to greater. It really seems to be, because no matter what I get exactly 5000 r

相关标签:
3条回答
  • 2020-12-21 10:33

    First of all, it's a server-side setting which limits the maximum number of entries returned in a single search. Default is 1'000.

    Secondly, if you really need to enumerate more than this limit of 1'000 entries, you should look into paged searches. Quite simply, set the DirectorySearcher.PageSize entry to a value (less than that system limit), e.g. 500, and you'll get your results in pages of 500 entries.

    There's no limit on how many entries you'll get in total - you can simply enumerate the DirectorySearcher.FindAll() collection and you should be able to handle any number of entries that way. The AD server will just simply batch up your results in pages of 500 - once you've enumerated one page, the next one will be delivered.

    Marc

    0 讨论(0)
  • 2020-12-21 10:47

    Try doing

            mySearcher.SizeLimit = int.MaxValue;
            mySearcher.PageSize = int.MaxValue;
    

    Does it still limit to 5k?

    0 讨论(0)
  • 2020-12-21 10:49

    Check if your Active Directory or your LDAP is capping the query results.

    We have a maximum of 1000 elements defined.

    0 讨论(0)
提交回复
热议问题