問題描述
目錄搜索器的 findall 結果方法是否限制為 5000 個結果,即使 pagesize 設置為更大.似乎真的是這樣,因為無論我得到什么結果都恰好是 5000.這是 C#
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 results. This is C#
推薦答案
首先,它是一個服務器端設置,它限制了一次搜索中返回的最大條目數.默認值為 1'000.
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.
其次,如果您確實需要枚舉超過 1,000 個條目的限制,您應該查看分頁搜索.很簡單,將 DirectorySearcher.PageSize
條目設置為一個值(小于該系統限制),例如500,您將在 500 個條目的頁面中獲得結果.
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.
您將獲得的條目總數沒有限制 - 您可以簡單地枚舉 DirectorySearcher.FindAll()
集合,并且您應該能夠以這種方式處理任意數量的條目.AD 服務器只會簡單地將您的結果以 500 頁為單位進行批處理 - 一旦您枚舉了一頁,就會傳送下一頁.
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.
馬克
這篇關于即使將 pagesize 設置為更大,directorysearcher 對象是否上限為 5000的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!