http://www.microsoft.com/windows2000/library/howitworks/activedirectory/adsilinks.asp

http://www.microsoft.com

rtk.htm interopt.htm ad.htm winnt.htm dev.htm ../default.htm router.gif (3874 bytes)

Communicating with the Netscape LDAP Server

 

Requirements

Connecting to the Netscape Server

  • You need to know the server you're connecting to.
  • You need to know one of its naming contexts, for example: O=Airius.com. If you don't know, please ask your Administrator.
  • You need to know a valid username and password. You can also use the anonymous bind. Note: you cannot use the currently logged on user who is connected to Netscape. You must either supply credentials, or default it to anonymous by setting username and password as an empty string. An empty string is different than a NULL string. Note: most of the ADS_AUTHENTICATION_ENUMs are not applicable when connecting to the Netscape Server.

Dim server
Dim company
Dim userName
Dim password
Dim dso

Dim adsPath


server = "myServer"
company = "O=Airius.com"

adsPath = "LDAP://" & server & "/" & company

'-- Supplied Credentials -----
userName = "cn=directory manager"
password = "password"

'----For anonymous credentials, use "" ---
'userName = ""
'password = ""

Set dso = GetObject("LDAP:")
Set cont = dso.OpenDSObject(adsPath, userName, password, 0)

Enumerating a Container

To enumerate a container, it's no different than enumerating container in other LDAP servers or other ADSI providers.

'--- Enumerating a container

For Each obj In cont
   Debug.Print obj.Name & " (" & obj.Class & ")"
Next

Searching for Objects

Use ADO , or IDirectorySearch (for VC++ users) to search for objects

'--- For searching

Dim con
Dim command
Dim rs

Set con = CreateObject("ADODB.Connection")
con.Provider = "ADsDSOObject"
con.Properties("User ID") = userName
con.Properties("Password") = password
con.Open "ADSI"


Set com = CreateObject("ADODB.Command")
Set com.ActiveConnection = con
com.CommandText = "SELECT ADsPath FROM '" & ADsPath & "' WHERE cn='a*'"
Set rs = com.Execute


While Not (rs.EOF)
  Debug.Print rs.Fields("ADsPath")
  rs.MoveNext
Wend


The source code can be found in the  \\samples\Interopt\Netscape directory.