magickarle
New Member
- Joined
- May 27, 2007
- Messages
- 18
I have searched all over the place for couple of days now and have bits and bytes of data but I am not able to execute my query.
What I am trying to do is query the LDAP with filter on employeeNumber and return the value of bellmanageremployeenumber.
I am not sure if the sUser and sDN are well defined but I am not getting any authentification error.
But I am getting a "run-time error 424: Object required" on "Set rs = oConn.Execute"
Sub tes101()
sUser = "ou=myusername,ou=applications,o=bell,c=ca"
sDN = "ou=myusername,ou=applications,o=bell,c=ca"
sPass = "mypass"
sRoot = "LDAP://ldaphostname:389/ou=BELL CANADA,ou=PEOPLE,o=BELL,c=CA"
Dim oDS: Set oDS = GetObject("LDAP:")
Dim oAuth: Set oAuth = oDS.OpenDSObject(sRoot, sDN, sPass, ADS_SERVER_BIND)
Dim oConn: Set oConn = CreateObject("ADODB.Connection")
oConn.Provider = "ADSDSOObject"
oConn.Open "Ads Provider", sDN, sPass
Dim rs
Set rs = oConn.Execute("<" & sRoot & ">;(employeeNumber=1234567);bellmanageremployeenumber;subtree")
wscript.echo rs("bellmanageremployeenumber").Value
End Sub
What I am trying to do is query the LDAP with filter on employeeNumber and return the value of bellmanageremployeenumber.
I am not sure if the sUser and sDN are well defined but I am not getting any authentification error.
But I am getting a "run-time error 424: Object required" on "Set rs = oConn.Execute"
Sub tes101()
sUser = "ou=myusername,ou=applications,o=bell,c=ca"
sDN = "ou=myusername,ou=applications,o=bell,c=ca"
sPass = "mypass"
sRoot = "LDAP://ldaphostname:389/ou=BELL CANADA,ou=PEOPLE,o=BELL,c=CA"
Dim oDS: Set oDS = GetObject("LDAP:")
Dim oAuth: Set oAuth = oDS.OpenDSObject(sRoot, sDN, sPass, ADS_SERVER_BIND)
Dim oConn: Set oConn = CreateObject("ADODB.Connection")
oConn.Provider = "ADSDSOObject"
oConn.Open "Ads Provider", sDN, sPass
Dim rs
Set rs = oConn.Execute("<" & sRoot & ">;(employeeNumber=1234567);bellmanageremployeenumber;subtree")
wscript.echo rs("bellmanageremployeenumber").Value
End Sub