Working with search filters by using the EWS Managed API 2.0
Find information about how to use search filters to search for items or folders in Exchange mailboxes.
Last modified: April 26, 2013
Applies to: EWS Managed API | Exchange Server 2007 Service Pack 1 (SP1) | Exchange Server 2010
Note: This content applies to the EWS Managed API 2.0 and earlier versions. For the latest information about the EWS Managed API, see Web services in Exchange.
The SearchFilter class represents the restriction or query that is used to filter items or folders in FindItem and FindFolder operations, and for search folders. You can use the abstract SearchFilter class to search an Exchange mailbox for items or folders that meet the criterion of a search filter, and all items in the returned collection will meet the criterion of that specific search filter. Use the descendant search filter classes to define a search filter.
Note
We recommend that you use Advanced Query Syntax (AQS) with the QueryString element to perform searches. In many cases, you can perform the same search by using the QueryString element that you can perform by using search filters. QueryString element searches are performed against a content index. Searches performed by using search filters, also called search restrictions, create a dynamic search folder that persists in memory for a short period of time. These in-memory search folders use more system resources than content index searches. For more information about using AQS search and EWS, see Searching an Exchange mailbox by using the EWS Managed API 2.0.
In this section
The following articles provide examples that show you how to use a search filter to return items from the Exchange mailbox that meet the specific search criteria:
Filtering on ContainsSubstring by using the EWS Managed API 2.0 — A search expression that checks for the presence of a substring inside a text property.
Filtering on ExcludesBitmask by using the EWS Managed API 2.0 — A search expression that contains a bitmask operator that filters on items that do not contain any of the specified bitwise mask.
Filtering on Exists by using the EWS Managed API 2.0 — A search expression that can be used to determine whether an item contains a specific property.
Filtering on IsEqualTo by using the EWS Managed API 2.0 — A search expression that compares a property with either a constant value or another property and determines whether they are equal.
Filtering on IsGreaterThan by using the EWS Managed API 2.0 — A search expression that compares a property with either a constant value or another property and determines whether one property is greater than another.
Filtering on IsGreaterThanOrEqualTo by using the EWS Managed API 2.0 — A search expression that compares a property with either a constant value or another property and determines whether one property is greater than or equal to another.
Filtering on IsLessThan by using the EWS Managed API 2.0 — A search expression that compares a property with either a constant value or another property and determines whether one property is less than another.
Filtering on IsLessThanOrEqualTo by using the EWS Managed API 2.0 — A search expression that compares a property with either a constant value or another property and determines whether one property is less than or equal to another.
Filtering on IsNotEqualTo by using the EWS Managed API 2.0 A search expression that compares a property with either a constant value or another property and determines whether they are not equal.
Filtering on Not by using the EWS Managed API 2.0 — A search expression that negates the Boolean value of the search expression that it contains.
Filtering on SearchFilterCollection by using the EWS Managed API 2.0 — A collection of search filters linked by a logical operator. Applications can use the SearchFilterCollection class to define complex search filters such as "Condition1 AND Condition2".