LDAP connection

spinkung

Registered User.
Local time
Today, 09:00
Joined
Dec 4, 2006
Messages
267
Hi

i'm trying to return a list of all users in my companies active directory.

i have :
Code:
Private Sub Command2_Click()

Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")

objConnection.provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
objCommand.ActiveConnection = objConnection
objCommand.Properties("Page Size") = 1000


objCommand.CommandText = _
"<LDAP://dc=ms1,dc=dddltd, dc=co, dc=uk>;(objectcategory=user);Name;Subtree"

Set objRecordset = objCommand.Execute

While Not objRecordset.EOF
 Debug.Print objRecordset.Fields("givenname") & "," & objRecordset.Fields("sn")


objRecordset.MoveNext
Wend

objConnection.Close

End Sub

...but i get the error message "There is no such object on the server"

anyone know what i'm doing wrong?


Thanks.
 

Users who are viewing this thread

Back
Top Bottom