R
Randy Bradley
While I can't find any documentation on how PagedSearching works for
the DirectorySearcher, I think I have the basics figured out. The
purpose of this post is to see if anybody out there can verify this,
and answer one remaining question.
When you set PaqeSize to any non-zero value, the call to
DirectorySearcher.FindAll() returns only an empty
SearchResultsCollection. In fact, FindAll() doesn't even touch the
directory at all. The reads to the directory occur when you access the
SearchResultsCollection.
If you get the Count of the SearchResultsCollection or access a
specific result using an indexer, then the entire
SearchResultsCollection is filled in (over 3000 in my case). However,
if you enumerate through the collection (using foreach()) then the
SearchResultsCollection is read using PageSize chunks as needed. For
instance, if the PageSize is set to 5, then on the first foreach()
loop, it reads in 5 objects, and when you get to the 6th object, it
reads in objects 6-10, ect.
My question is this: Is there any way to access the Nth page of
objects without reading all the prior pages. I tried :
SearchResult result = results[6];
but this fills the entire SearchResults collection just like getting
the SearchResultsCollection.Count does.
Any help is appreciated,
Thanks
Randy.
the DirectorySearcher, I think I have the basics figured out. The
purpose of this post is to see if anybody out there can verify this,
and answer one remaining question.
When you set PaqeSize to any non-zero value, the call to
DirectorySearcher.FindAll() returns only an empty
SearchResultsCollection. In fact, FindAll() doesn't even touch the
directory at all. The reads to the directory occur when you access the
SearchResultsCollection.
If you get the Count of the SearchResultsCollection or access a
specific result using an indexer, then the entire
SearchResultsCollection is filled in (over 3000 in my case). However,
if you enumerate through the collection (using foreach()) then the
SearchResultsCollection is read using PageSize chunks as needed. For
instance, if the PageSize is set to 5, then on the first foreach()
loop, it reads in 5 objects, and when you get to the 6th object, it
reads in objects 6-10, ect.
My question is this: Is there any way to access the Nth page of
objects without reading all the prior pages. I tried :
SearchResult result = results[6];
but this fills the entire SearchResults collection just like getting
the SearchResultsCollection.Count does.
Any help is appreciated,
Thanks
Randy.