Recordset returns only 1000 records

I am doing the ADODB recordset.open () command with an LDAP query to get all users from my Active Directory.

There are about 2600 users, but I get only 1000 of them.

I tried changing the Recordset PageSize and MaxRecords properties with no luck.

Without extraneous things, this looks like code (I made general information about the connection):

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 definitely only returns 1000 records (I confirmed), and I can access them simply.

In case this helps, the reason I am not using DirectorySearcher is that it is so slow compared to this.

+6
c # active-directory adodb recordset
source share
2 answers
+2
source share

The 1000 limit is discussed here - essentially, it is fixed on the server, so you will need to talk to the owner ...

+2
source share

All Articles