This topic describes the general rules for specifying properties in filters that are supported by various objects in Outlook. For more information about specifying conditions on properties to complete a filter, see the topics in the Filter Syntax section.
A filter is a condition or a set of conditions that you can apply to a set of items to obtain a subset of items that meets the specified conditions. Outlook supports filters by using the Microsoft Jet query language syntax or the DAV Searching and Locating (DASL) syntax. Note that the Jet query language syntax has the same syntax as that supported by Microsoft Jet Expression Service, hence the name Jet query language.
As an example, you can filter contact items in your Contacts folder to obtain a list of contacts residing in Canada. In this case, you'll be filtering on the HomeAddressCountry property. The filter, expressed as a Jet filter, will be
"[HomeAddressCountry] = 'Canada'".
Outlook provides filtering through the following entry points:
|Entry point||Jet filter support||DASL filter support|
|Items.Find||Yes||Yes. Note that if you use the query keywords ci_phrasematch or ci_startswith in the filter, you'll get an error.|
|Table.FindRow||Yes||Yes. Note that if you use the query keywords ci_phrasematch or ci_startswith in the filter, you'll get an error.|
A filter must contain a query in either Jet or DASL syntax but not a mixture of both.
When specifying properties in a Jet filter or DASL filter using any of the above entry points, follow these guidelines.
|Jet filter||DASL filter|
|Applicable properties||Most explicit built-in and custom item-level properties; see corresponding method topic for unsupported properties.||Most built-in and custom item-level properties with and without explicit string names; see corresponding method topic for unsupported properties.|
||By their namespaces.|
|Format of reference||
|Error conditions||Returns an error if a custom property in the filter is not defined, or the filter is empty, has an invalid argument, or cannot be parsed.||Returns an error if a custom property in the filter is not defined, or the filter is empty, has an invalid argument, or cannot be parsed.|
The syntax of a filter depends on the type of the property you are filtering on. The following topics provide further information about how to construct a filter based on a specific property type:
- Filtering a Custom Field
- Filtering Items Using a Boolean Comparison
- Filtering Items Using a Comparison with a Keywords Property
- Filtering Items Using a Date-time Comparison
- Filtering Items Using a String Comparison
- Filtering Items Using a Variable
- Filtering Items Using an Integer Comparison
- Filtering Items Using Comparison and Logical Operators
- Filtering Items Using Query Keywords
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.