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.
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
The 1000 limit is discussed here - essentially, it is fixed at the server, so you're going to need to speak to the owner...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With