By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,917 Members | 1,730 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,917 IT Pros & Developers. It's quick & easy.

vb.net & adsi responses > 1000

P: n/a
I'm new to VB.NET and ADSI. By default it appears the adsi limits objects
returned to 1000 items. I've seen web references that say that the limit is
imposed by unpaged queries. I added an explicit pagesize statement, and the
findall.count value went up from 1000 to 4000+ for the OU that I'm querying.
(with considerable added delay in response). However when I try to iterate
through a for-each loop, I still seem to get only 1000 items. Subsequent
"get" statements return the same first 1000 items. I know that I'm doing
something ignorant, but I don't know how to get beyond the first 1000 items
returned. Looking for a vb example that could get me past this. For my
purposes in this item, I really do need to return all the objects in the OU
and I know that there are more than 4000 user objects in this OU. My code
looks something like the following:

ldapquerystring = "LDAP://" & DistName

ds.SearchRoot = New DirectoryEntry(ldapquerystring)
ds.PageSize = 1000

Dim dsResult As DirectoryServices.SearchResult

i1 = ds.FindAll.Count
iterations = i1 / 1000

For iterCount = 1 To iterations
objContainer = GetObject(ldapquerystring)
For Each objUser In objContainer
i1 = 0 'reset the test value
strName = objUser.Name
i1 = strName.Length
If i1 > 0 Then
strDesc = objUser.Description
userFN = objUser.Get("givenName")
userSN = objUser.Get("sn")
userDesc = objUser.Get("description")
userCAI = objUser.Get("cvx-cai")
userBillCAI = objUser.Get("cvx-BillingCAI")
userDispN = objUser.Get("displayName")
outline = strName & "%" & userFN & "%" & userSN & "%" &
userDesc & "%" & userCAI & "%" & userBillCAI & "%" & userDispN & "%" &
DistName
WriteIt(outline)
End If
Next 'ObjUser
objContainer = GetObject(ldapquerystring)
Next 'Itercount

--
Rick
Nov 21 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.