The connection object Execute method's CommandText (first object) is an LDAP query composed of four elements separated by semicolons, in the following format:
- server is the name (or IP address) of the server hosting the directory.
- adsidn is the distinguished name (DN) of the starting point for your query expressed ADsPath format with "/" separators and the root of the namespace to the left. You can also use an X.500 style attributed name format with the relative distinguished names separated by commas and the root of the name space to the right.
- 1dap filter is the LDAP filter string (see rfc2254).
- attributescsv is a comma separated list of names of the attributes to be returned for each row in the recordset.
- scope is either: base, onelevel, or subtree.
To return the ADsPath, class, and cn attributes of all the objects in all the recipient containers in an Exchange server, you can use the following CommandText (in URL format):
Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset
Set conn = New ADODB.Connection
conn.Provider = "ADSDSOObject"
conn.Open "ADs Provider"
Set rs = conn.Execute( _
While Not rs.EOF
Debug.Print rs.Fields(0).Value, rs.Fields(1).Value, _
ID článku: 187529 – Posledná kontrola: 4. 8. 2008 – Revízia: 1