Question : Active Directory Queries with ADO

I am using ADO to return some Active Directory info, which works fine... up to a point.  I am not getting back as many "rows" as expected and I see references to setting a page size on the ado command object property by that name.  My  assumption is that this value is defaulted to 1000 and I should set it to a larger value.

However,  when I attempt to do so,  the error message is that the property is read only.  Yet I see many examples setting this property in my searches.

I will include the snippet below.

Thanks,
Howard
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
Dim con As New ADODB.Connection, rs As New ADODB.Recordset
        Dim Com As New ADODB.Command
 
            'Open a Connection object 
            '-------------------------------------------- 
            con.Provider = "ADsDSOObject"
 
            con.Open("Active Directory Provider")
 
            'Create a command object on this connection 
            Com.ActiveConnection = con
            Com.CommandText = "select extensionattribute1, department, msExchHomeServerName, sAMAccountName, distinguishedName, name, mail from 'LDAP://DC=someDomain,DC=NOM' where objectClass='user' ORDER BY NAME"
 
            Com.Properties("Page Size") = 10000    '<<<<-- no good, property is readonly???

Answer : Active Directory Queries with ADO

Hi there,

I don't seem to be getting the same problem here using ADO (type library 2.7).

Try using : Com.Properties("Page Size").Value = 1000

(without specifying 'Value=1000' I was getting 'this property is read only' from intellisense)

Bear in mind that you don't really need to set a page size as high as 10000 - as long as you set a page size, then all results will return. 1000 should be fine.

Tony

Random Solutions  
 
programming4us programming4us