Skip Navigation Links
Home
+
About
+
Products
+
Support
+
Purchase
+
Search
+
Disconnect (Method of LDAPClient)
Unbind from the directory server.
Syntax
Disconnect
Remarks
After Disconnect is called, all open objects will remain valid until they are destroyed. However, the LDAPClient (and LDAPControl) objects can not be used to query or create objects again until Connect is called again.
Example
' Find first names of all the Smiths.

Set pLDAP = CreateObject("LDAPClient.3")
Call pLDAP.Connect("ldapserver")

Set pAttributeNames = CreateObject("LDAPClient.StringCollection")
Call pAttributeNames.Add("givenName")

' Find all the Johns and all the Smiths
Set pEntries = pLDAP.Search("o=airius.com", "(|(givenName=John)(sn=Smith))", , pAttributeNames)
For Each pEntry In pEntries
    MsgBox pEntry.Attributes("givenName").Values(0).Value
Next

Call pLDAP.Disconnect

' Try finding all Johns and all Smiths again
Set pEntries2 = pLDAP.Search("o=airius.com", "(|(givenName=John)(sn=Smith))", , pAttributeNames)

' pEntries2 will be an empty LDAPEntryCollection since Search was called after Disconnect
For Each pEntry In pEntries2
    MsgBox pEntry.Attributes("givenName").Values(0).Value
Next