There is a filter option available that works with Views, Search folders, Advanced Find, and Automatic formatting or Conditional formatting. It's called Query Builder and it's simple to enable and easy to use. To enable it, add the appropriate key called QueryBuilder to your registry.
HKEY_CURRENT_USER\Software\Microsoft\Office\xx.0\Outlook\QueryBuilder
where xx.0 equals your Outlook version number.
To use the QueryBuilder, select the QueryBuilder tab from the Filter dialog and select or enter the criteria. After adding two or more conditions, select a group and choose the AND or OR operator from the logical group menu. Create nested conditions by moving the criteria up or down.
For example, QueryBuilder allows you to create one filter that looks for messages received today from Mary OR for messages received today which request a read receipt. Using the Advanced filter you needed two separate filter rules, one for each condition. QueryBuilder needs just one rule and looks like this:
- AND
messages received today
- OR
from Mary
request a read receipt
You're probably wondering why QueryBuilder remains largely unknown when the ability to create OR filters is often requested. Apparently QueryBuilder can cause instability in Outlook. Your mileage may vary, but I've used it off and on since Outlook 2002 without a problem and it's worth trying if you need to create filters using OR.
Don't want to edit your registry? See Do it for me for reg files. Download then double click on the file to make the change to your registry.
Outlook 2016
HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Outlook
Create key named: QueryBuilder
Outlook 2013
HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Outlook
Create key named: QueryBuilder
Outlook 2010
HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Outlook
Create key named: QueryBuilder
Outlook 2007
HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Outlook
Create key named: QueryBuilder
Outlook 2003
HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Outlook
Create key named: QueryBuilder
Outlook 2002
HKEY_CURRENT_USER\Software\Microsoft\Office\10.0\Outlook
Create key named: QueryBuilder
Do it for me
Click on the appropriate link to download a registry file (*.reg) containing the QueryBuilder key and add it to your registry. If you want to view the file before installing it, save it to your hard drive and open the *.reg file in Notepad. To install, double click on the file.
Outlook 2016 Outlook 2013 Outlook 2010
Outlook 2007 Outlook 2003 Outlook 2002
You do not need to close Outlook or restart it after adding the key to your registry.
Query Builder and From Addresses
The problem: You want to use Query Builder to create a Search folder that filters by email address, but Outlook's Query Builder appears to ignore the email address and uses the display name instead. The only time it works as expected is when the email address is the display name.
The cause: The filter dialog has two From fields. The From field on the first tab uses the email address while the From field you use on the Advanced tab uses the display name. The Query Builder uses the same From field used by the Advanced tab.
The solution: Install a CFG to expose the email address field then use that field in your query. We have a custom CFG available for download along with installation instructions available at Adding Extended MAPI Fields to Outlook.
Thanks for this page... years later and it's still helpful!
This doesn't say it, but seems even m365 is at v16.0, right? So the reg file for 2016 works for 2016 and newer?
And would you know - is there a way to export / manage a set of criteria from another way other than in the (limited) query builder in outlook?
My OCD is wanting me to alphabetize the criteria.
Or if someone else wants that query that I have. Any way to give it to them that they can import into their outlook?
I have the same criteria of a search folder on 2 different PCs using the same mailbox. So the folder / criteria are stored on the exchange server, not on the PC? not sure using m365 exchange, if that makes it easier to get the criteria? a power shell script?
Is it possible to bring events and messages into one view?
This is great - thank you! I think it's funny that Microsoft would advise "QueryBuilder can cause instability in Outlook" because, in my experience, crappy hacked-together SQL queries are even less stable!
I keep coming across your site, or your post on MS boards! Thanks for all the insight on rules and filtering.
I'm a bit stunned that this actually worked. But it worked.
Thank you!
Hi Diane,
I could already convince our IT department to do the registry trick but what I still cannot implement is an AND search folder with certain categories. I'm using categories like "Finance", "Budget", "FY1718" and "FY1819".
And I would like to have a search folder for all mails having the categories "Budget" AND "FY1819".
Do you maybe have a hint how to insert that in the query builder?
When I use the given machanisms without the query builder I can select the desired categories but then the search folder gives me all emails with "Budget" (which could be related to several fiscal years) AND all emails with "FY1819" (which could also be related to other matters than budget).
Thanks in advance for any hint!
Carsten
Carsten, in case you still need this: upon enabling Query Builder, use that tab to first create a Categories Contains Finance entry. Click Add to make sure that entry is populated in the above window. Then, create a new entry for Categories Contains FY1819, and click Add again. The logic will default to AND such that "ALL clauses must be true" and will return the hits you're looking for.
Make sure to leave the More Choices tab empty for Categories, and make sure you're using CATEGORIES, which is a Mail field and not CATEGORY, which is a Document field.
Hope you already implemented this or that this helps.
Mark
Diane, thanks for your useful advice. Your MapIt regedit was helpful. In this case,
I couldn't find QueryBuilder in my RegEdit. Using SEARCH I found one QueryBuilder in the RegEdit
under Explorer, but none under Office or Outlook.
I have Japanese Windows, so perhaps the QueryBuilder function was removed
for some languages.
It's not present in the registry by default, so you need to add the key to all computers - as long as the office keys are in the registry in English, then it should work - if it needs localized, it don't know what it would be.
Hello Diane,
Is there a way to have the search folder looking for one or two keywords but only in the last reply and not the entire body of the e-mail?
I'd like to get all my mails that have a request for my actions in one folder. Often there are multiple ppl. in the to field of mails I receive and even if my address is there, it's not always directed to me for an action. I would like to disregard mails where I may have already replied back earlier and someone else should handle the case but the sender forgot to remove me or add to CC instead.
Therefore, I'd like to go beyond looking just for the mail address and see if my name actually appears in the first few lines of the message. How would this be possible with Query Builder or any other search tool in MS-Outlook?
No, sorry. it will find all matches. You can't limit the search the the first few lines using the search tools native to outlook. Not sure if 3rd party utilities could do that. One option is a macro - you can limit it to searching the first nn characters. I'm not sure what might be the best way to implement this - maybe run it on the search folder to add a flag or category if the search term is within nn characters.