DirectorySearcher.Filter

The Filter property gets or sets the Lightweight Directory Access Protocol (LDAP) format filter string.

public String Filter {get; set;}
Public Property Filter As String

Property Value

The search filter string in LDAP format, such as "(objectClass=user)". The default is "(objectClass=*)", which retrieves all objects.

Remarks

The filter uses the following guidelines:

  1. The string must be enclosed in parentheses.
  2. Expressions can use the relational operators: <, <=, =, >=, and >. An example is "(objectClass=user)". Another example is "(lastName>=Davis)".
  3. Compound expressions are formed with the prefix operators & and |. An example is "(&(objectClass=user)(lastName= Davis))". Another example is "(&(objectClass=printer)(|(building=42)(building=43)))".

When the filter contains an attribute of ADS_UTC_TIME type, its value must be of the yymmddhhmmssZ format where y, m, d, h, m, and s stand for year, month, day, hour, minute, and second, respectively. Note that the seconds (ss) value is optional. The final letter Z means there is no time differential. In this format, "10:20:00 A.M. May 13, 1999" becomes "990513102000Z". Note that Active Directory stores date and time as GMT time. If you specify a time with no time differential, you are specifying the time in GMT time.

If you are not in the GMT time zone, you can add a differential value to the GMT (instead of specifying Z) to specify a time according to your time zone. The differential is based on the following: differential = GMT- Local. To specify a differential, use the following format: yymmddhhmmss[+/-]hhmm. For example, "8:52:58 P.M. March 23, 1999" New Zealand Standard Time (the differential is 12 hours) is specified as "19990323205258.0+1200".

Requirements

Client Requires Windows XP Home Edition, Windows XP Professional, Windows Me, or Windows 98.
Server Requires Windows Server 2003, Windows 2000, or Windows NT 4.0.
Namespace

Defined in System.DirectoryServices.

Assembly

Requires System.DirectoryServices (in System.DirectoryServices.dll).

.NET Framework

Requires .NET Framework 1.0.

See Also

DirectorySearcher, DirectorySearcher Constructors, DirectorySearcher Methods, DirectorySearcher Properties, System.DirectoryServices Namespace, DirectorySearcher Members (Visual J# Syntax), Managed Extensions for C++ Programming