If you want to use ADO to perform a Lightweight Directory Access Protocol (LDAP) search, you need to specify four arguments: search base, filter, attributes, and scope. Although specifying the search base, attributes, and scope arguments is straightfoward (see Alistair G. Lowe-Norris, "An ADSI Primer, Part 5: Using ADO to Script Fast ADSI Searches," page 1), specifying the filter argument isn't.
The filter argument defines which objects match the query you want to perform. Because you can use a filter on any property of any object, you can conduct powerful searches. For example, you can search for any object that has a description matching a text substring you specify. (You can't match long integers and other nontext data types.)
Although filters let you conduct powerful searches, working with filters can seem complex because they must follow the format that Request for Comments (RFC) 1960 dictates. For example, the format dictates that filters are case-sensitive, that you must not have any spaces within a string in a filter, that you must enclose each filter in parentheses, and that you must use semicolons with no spaces before or after to separate filters. You can download the text of RFC 1960 from ftp://ftp.isi.edu/in-notes/rfc1960.txt. . . .
Why become a VIP member?
 |
VIP-only online access |
 |
VIP CD delivered twice a year: offline access to the entire Windows IT Pro article library |
 |
Monthly issue of your choice of Windows IT Pro or SQL Server Magazine |


Peter Kryszak April 21, 2004