LDAP Searching

J

Jon Beverley

I am looking for some assistance with searching a third part LDAP database.
I have managed to read from it and write to it using
Dim objAD As ActiveDs.IADs

Dim objDS As ActiveDs.IADsOpenDSObject

Dim objContainer As ActiveDs.IADsContainer

Dim strUser As String

Dim strPassword As String

Dim strServerIPAddress As String

Dim strServerPort As String

Dim strLDAPConnection As String

strUser = "UserName"

strPassword = "password"

strServerIPAddress = "xxx.xxx.xxx.xxx"

strServerPort = "4000"

strLDAPConnection = "LDAP://" & strServerIPAddress & ":" & strServerPort &
"/"

'Connect to database

objDS = GetObject("LDAP:")

objContainer = objDS.OpenDSObject(strLDAPConnection & "CN=Users", strUser,
strPassword, 32)

'Get Object we're interested in

objAD = objContainer.GetObject("User", "CN=Bev")

'Update Property

objAD.Put("extRef", "test")

'Read Property

MsgBox(objAD.Get("description"))



But I cant seem to find a way to search the database.

Any help would be much apreciated.

Bev
 
P

Paul Clement

¤ I am looking for some assistance with searching a third part LDAP database.
¤ I have managed to read from it and write to it using
¤ Dim objAD As ActiveDs.IADs
¤
¤ Dim objDS As ActiveDs.IADsOpenDSObject
¤
¤ Dim objContainer As ActiveDs.IADsContainer
¤
¤ Dim strUser As String
¤
¤ Dim strPassword As String
¤
¤ Dim strServerIPAddress As String
¤
¤ Dim strServerPort As String
¤
¤ Dim strLDAPConnection As String
¤
¤ strUser = "UserName"
¤
¤ strPassword = "password"
¤
¤ strServerIPAddress = "xxx.xxx.xxx.xxx"
¤
¤ strServerPort = "4000"
¤
¤ strLDAPConnection = "LDAP://" & strServerIPAddress & ":" & strServerPort &
¤ "/"
¤
¤ 'Connect to database
¤
¤ objDS = GetObject("LDAP:")
¤
¤ objContainer = objDS.OpenDSObject(strLDAPConnection & "CN=Users", strUser,
¤ strPassword, 32)
¤
¤ 'Get Object we're interested in
¤
¤ objAD = objContainer.GetObject("User", "CN=Bev")
¤
¤ 'Update Property
¤
¤ objAD.Put("extRef", "test")
¤
¤ 'Read Property
¤
¤ MsgBox(objAD.Get("description"))
¤
¤
¤

Use the System.DirectoryServices namespace instead of ADSI.

http://msdn.microsoft.com/library/d...ml/vbtsksearchingactivedirectoryhierarchy.asp


Paul
~~~~
Microsoft MVP (Visual Basic)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top