LDAP query with BIND authentification

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
 

Forum statistics

Threads
1,226,870
Messages
6,193,439
Members
453,799
Latest member
shanley ducker

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top