Skip Navigation Links
Home
+
About
+
Products
+
Support
+
Purchase
+
Search
+
Search (Method of LDAPClient)
Search the directory and retrieve Entries.
Syntax
Search(Base As String, Filter As String, [ Scope As axldapScope = axldapScopeSubTree ], [ AttributeNames As Variant = Nothing ], [ Timeout As Long = 0 ], [ IgnoreSizeLimitError As Boolean = False ]) As LDAPEntryCollection
Remarks
Executes the search using the specified base DN, filter and scope and returns the results in a collection of Entry Objects. The default scope is axldapScopeSubTree, which will search the subtree of the given base DN. If a timeout is specified, the search will fail after the sepecified number of seconds with a trappable error. To specify an infinite timeout, use '0' or don't specify a Value. To limit the types of attributes returned by the server, pass a StringCollection with the names of desired attributes in the AttributeNames Parameter. For a complete description of search syntax, see RFC 1558: A String Representation of LDAP Search Filters (http://www.umich.edu/~dirsvcs/ldap/doc/rfc/rfc1558.txt).
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