Is there any way I can specify AND and OR operators when using Advanced Find or creating more complex custom Views or Search Folders?
Many complex searches and filters can already be done on the Advanced tab of Advanced Find when searching for an item or creating a Search Folder or within the Filter section when creating a custom view.
However, you’ll find that when you specify multiple values for the same field, it will use the OR operator and when adding another field, it will use the AND operator. This sometimes leads to unexpected results or not being able to execute some queries.
For instance, say that you want to find a specific email related to a certain project. Some emails you’ve already assigned the Project1 category so you want those to be included in your search results either way. Then, in order to find the rest, you specify people you’ve worked with in the project and several words that are related to the project.
So this query requires;
- an OR operator when specifying the names
(as they could be or from person A or from person B or from person C or to person A, or to Person B or to person C)
- an OR operator when specifying the words
- an AND operator for the combination of persons and words
- an OR operator between the project category and the combination of results specified at point 3.
You cannot do this with the options that you find on the Advanced tab.
Enable the Query Builder
In order to still achieve the desired results, you can enable the Query Builder which does allow you to control the AND and OR relation in your searches (yes, even nesting!). Enabling it needs to be done via the Registry.
- Open the registry editor:
- Windows XP
Start-> Run-> type:
- Windows Vista, Windows 7, Windows 8 and Windows 10
- Windows XP
- Browse to the following location in the registry
- Choose: Edit-> New Key
- Name the key:
Using the Query Builder
When you now open any search or filter dialog in Outlook, you’ll also have a Query Builder tab. It works similar to the Advanced tab but now you are in control over the AND and OR operators and you can group and nest sub queries together to get the results you need.
To change the AND/OR condition, click on AND/OR and then use the “Logical Group” dropdown list to select the other operator.
To create a new AND/OR group for a specific condition, select the item and use the Move Up/Move Down button until a new group is being created.
Once you’ve created all the groups and items, you can use the Move Up/Move Down buttons to sort them accordingly.
The Query Builder tab in Advanced Find allows for complex AND/OR queries.