Search the directory. For a complete description of search syntax, see RFC 1558: A String Representation of LDAP Search Filters (http://www.faqs.org/rfcs/rfc1558.html).
[Visual Basic] Public Function Search( _ ByVal base As String, _ ByVal filter As String, _ ByVal scope As Scope, _ ByVal attributeNames As StringCollection, _ ByVal timeout As Integer, _ ByVal ignoreSizeLimitError As Boolean _ ) As EntryCollection [C#] public EntryCollection Search( string base, string filter, Scope scope, StringCollection attributeNames, int timeout, bool ignoreSizeLimitError ); [C++] public: EntryCollection* Search( String* base, String* filter, Scope scope, StringCollection* attributeNames, int timeout, bool ignoreSizeLimitError ); [JScript] public function Search( String base, String filter, Scope scope, StringCollection attributeNames, int timeout, bool ignoreSizeLimitError ): EntryCollection;
Collection of entries matching the search query.
[C#] using System;
using System.Collections.Specialized;
using LdapServices.Ldap;
namespace LDAPSampleCodeConsole
{
class SampleApp
{
static void Main(string[] args)
{
Client client = new Client();
// Connect to the directory
client.Connect("directory.yourCompany.ca");
// Search the directory for entries with surname starting with 'Ab'
EntryCollection entries;
StringCollection attributes = new StringCollection();
attributes.Add("cn");
// Time out in 5 seconds
// Ignore the size limit error
entries = client.Search("o=yourCompany,c=ca", "sn=Ab*", Scope.SubTree, attributes, 5, true);
// Display the result counts
Console.WriteLine("Count: " + entries.Count);
Console.WriteLine("Attribute Count: " + entries[0].Attributes.Count);
// Disconnect
client.Disconnect();
}
}
}
Client Class | LdapServices.Ldap Namespace | Client.Search Overload List