Using Query Builder

Last reviewed on October 26, 2013

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.

Use the query builder to create filters

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 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 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.

Written by

Diane Poremsky
A Microsoft Outlook Most Valuable Professional (MVP) since 1999, Diane is the author of several books, including Outlook 2013 Absolute Beginners Book. She also created video training CDs and online training classes for Microsoft Outlook. You can find her helping people online in Outlook Forums as well as in the Microsoft Answers and TechNet forums.

Please post long or more complicated questions at Outlookforums.

14 responses to “Using Query Builder”

  1. Fabrice

    Hi,

    I'm trying to create a query in order to view only non read emails but from 4 differents IMAP email folder.
    Even using the query builder I was not able to search through multiple folders.

    Thanks for your help

    Regards

    Fabrice

  2. Dominic

    Awesome! Thanks a lot. Had been looking around for something like this for sometime now.

  3. KoolPal

    Hi,

    I created the key as described here:
    Outlook 2010
    HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Outlook
    Create key named: QueryBuilder

    I am still unable to see the option in Search Folders. What am I doing wrong?

  4. KoolPal

    Thanks for the quick response Diane. I operate in an environment where regedit is blocked by admin.

    The IT admin came over and typed it in.

    I tried immediately after regedit was done as well as after restarting outlook & windows 7.

    What else could I check?

  5. KoolPal

    Sorry was caught in daily humdrum of emails. I rechecked. All correctly typed.

    What else can I check / fix?

    Please help

  6. KoolPal

    If it helps, I am on Windows 7 Professional, SP1 on 64 bit OS
    My Outlook installation is: Version 14.0.6112.5000 (32-bit)
    Part of Office Professional Plus 2010

    I am not sure if this information can help you diagnose and help further.

  7. KoolPal

    I had left a few replies with details of my Outlook and Windows Setup. The status shown was pending moderation.

    Did you get a chance to review those?

  8. Phil

    How exactly would you create this condition?

    - AND
    messages received today
    - OR
    from Mary
    request a read receipt

Leave a Reply

If the Post Coment button disappears, press your Tab key.