Reputation: 1398
I'm doing an ADODB recordset.open() command with an LDAP query to get all the users from my Active Directory.
There are about 2600 users, but I'm only getting back 1000 of them.
I've tried altering the recordset's PageSize and MaxRecords properties with no luck.
Without extraneous stuff, this is what the code looks like (I've made the connection details generic):
ADODB.Connection conn = new ADODB.Connection();
ADODB.Recordset rs = new ADODB.Recordset();
rs.MaxRecords = 10000;
rs.PageSize = 10000;
conn.Open("Active Directory Provider","","",0);
string query = "SELECT cn FROM 'LDAP://OU=User Accounts,OU=TopLevel,DC=domainName,DC=local' where samAccountName = '*'"
rs.Open(query, conn, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockOptimistic, -1);
It's definitely only returning 1000 records, (I've confirmed), and I can access them just fine.
In case it helps, the reason I'm not using DirectorySearcher is because it's so slow in comparison to this.
Upvotes: 6
Views: 2497
Reputation: 1063338
The 1000 limit is discussed here - essentially, it is fixed at the server, so you're going to need to speak to the owner...
Upvotes: 2
Reputation: 26910
You have to set the page size on connection, not on the Recordset
.
Ref: http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/e483c098-b2c1-4037-b9fb-3c882f3b14c4 http://support.microsoft.com/?kbid=243281
Upvotes: 2