• Outlook User
  • New Outlook app
  • Outlook.com
  • Outlook Mac
  • Outlook & iCloud
  • Developer
  • Microsoft 365 Admin
    • Common Problems
    • Microsoft 365
    • Outlook BCM
    • Utilities & Addins

Using Query Builder

Slipstick Systems

› Outlook › Using Query Builder

Last reviewed on November 25, 2024     41 Comments

Applies to: Outlook (classic), Windows

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

Using Query Builder was last modified: November 25th, 2024 by Diane Poremsky
Post Views: 50

Related Posts:

  • Search folders & Deleted items
  • Create a conditional formatting rule
    Where is the Organizer?
  • 2024-08-12_10-44-16
    Create views using SQL/DAVX filters
  • Outlook’s New Account Setup Wizard

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

Comments

  1. Adam Williams says

    July 14, 2023 at 12:50 pm

    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?

    Reply
  2. Jeanine says

    April 17, 2023 at 7:04 pm

    Is it possible to bring events and messages into one view?

    Reply
  3. Nathan says

    August 13, 2021 at 5:06 pm

    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!

    Reply
  4. heavymod says

    May 9, 2020 at 2:38 am

    I keep coming across your site, or your post on MS boards! Thanks for all the insight on rules and filtering.

    Reply
  5. Ben says

    September 20, 2019 at 9:59 am

    I'm a bit stunned that this actually worked. But it worked.
    Thank you!

    Reply
  6. Carsten says

    September 6, 2018 at 7:18 am

    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

    Reply
    • Mark says

      July 13, 2021 at 10:52 pm

      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

      Reply
  7. Todd says

    May 22, 2017 at 9:37 pm

    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.

    Reply
    • Diane Poremsky says

      May 23, 2017 at 12:20 am

      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.

      Reply
  8. Peter says

    December 2, 2016 at 9:10 am

    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?

    Reply
    • Diane Poremsky says

      March 7, 2017 at 11:52 pm

      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.

      Reply
  9. Joy says

    November 30, 2016 at 2:24 pm

    Diane, I'm looking for a way to create a conditional format in a folder based on all messages that are older than 30 minutes. I've tried the Advanced tab in the Filter dialog box and even turned on the Query Builder tab here. (Great tip by the way!!) How would I construct the criteria for these messages?

    Thanks in advance!! You Rock!

    Reply
  10. Dan says

    October 23, 2016 at 8:40 am

    Thanks for the info. I was able to enable query builder, but it appears that it cannot be used to search for key words in attachments, for example PDF attachments. Is this really correct? If so, it severely limits the usefulness of query builder

    Reply
    • Diane Poremsky says

      October 29, 2016 at 1:01 am

      the query builder is based on views and no, it doesn't search attachments. You need to use instant search if you want to look for words in attachments.

      Reply
  11. Fernando Giannini says

    July 1, 2016 at 9:34 am

    Hi Diane! I'm trying to create a search folder (using the query builder) to filter messages where I am in the To Field with other people but I don't want to see messages where I am the only person in the To field (I already have a different folder for that). Is there a way to do that using only the search criteria?
    Thanks in advance!

    Reply
    • Diane Poremsky says

      July 6, 2016 at 12:26 am

      On the Messages tab of the filter dialog, Where I am... has an option for on the to line with other people. (At least in 2016... it should be in older versions too.)

      Reply
  12. David says

    January 4, 2016 at 7:14 am

    Hello. I'm using "query builder" in my 2015 pst. I need to create the 2016 pst and export hundred's of query's for this new one. Is there an option to do that? Thanks in advance for any feedback :-)

    Reply
    • Diane Poremsky says

      February 29, 2016 at 1:57 am

      No, query's can't be exported. It would be easier to use a copy of the same pst and delete all of the old mail, or if you no longer need the queries in 2015 pst, archive the old mail to a new data file.

      Reply
  13. crs says

    October 2, 2015 at 5:00 pm

    Thank you, Diane Poremsky. Query Builder is the solution I was looking for - gave me the multiple "OR" condition for different criteria.

    Reply
  14. Wayne Harropson says

    March 27, 2015 at 2:52 pm

    The registry entry screen capture is here,
    https://www.dropbox.com/s/kenbsk1oavk670i/QBuilderreg.gif?dl=0

    Reply
  15. Wayne Harropson says

    March 27, 2015 at 2:46 pm

    I just installed on my laptop, also in Outlook 2010. Same deal, dead drop down. https://www.dropbox.com/s/w3gl6v9l0w3y56s/QBuilderGrayout..gif?dl=0

    Reply
    • Diane Poremsky says

      March 27, 2015 at 4:57 pm

      If you add 2 fields and conditions, the buttons on the right should be enabled.

      Reply
  16. Wayne Harropson says

    March 27, 2015 at 2:12 pm

    My LogicalGroup drop down is dead, therefore "no filter criteria specified".
    Query builder will be absolutely perfect for my needs once I can get the grayed out items in the dialog to take entries. The reg entries appear installed correctly for my Outlook 10 version. I I shut down and restarted outlook, I'll try system reboot next.

    Reply
    • Diane Poremsky says

      March 27, 2015 at 2:30 pm

      If a reboot doesn't fix (i suspect it won't make a difference), please post a screenshot somewhere and post a link here. (You can post it at forums.slipstick.com if you don't use OneDrive or similar service. )

      Reply
  17. roee says

    September 7, 2014 at 3:34 am

    Hi, I'm using Outlook 2013 and the problem of using a filter based on sender's email (rather its name) still exists.
    Do you have any idea if this is something MS considers a bug and is going to fix?

    Reply
    • Diane Poremsky says

      September 7, 2014 at 11:40 pm

      I don't think it will be fixed anytime soon (but I'd love to be wrong!) - they'd need to do some rewriting of the filters to make the change. If you use the From field on the General page, the address should work.

      Reply
      • roee says

        September 8, 2014 at 3:28 am

        Tx.

  18. Phil says

    May 30, 2014 at 12:37 pm

    How exactly would you create this condition?

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

    Reply
    • Diane Poremsky says

      May 30, 2014 at 9:32 pm

      So you want to see all messages received today, that are either from mary or are a read receipt?
      queryfilter

      To limit it to only read recipients, you need the unique part of message class (IPNRN) or the full message class: REPORT.IPM.Note.IPNRN. I didn't have any to filter on, or any mary's. :)

      Reply
  19. KoolPal says

    February 21, 2014 at 1:54 am

    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?

    Reply
    • Diane Poremsky says

      February 21, 2014 at 9:39 am

      No, not yet. Thursday is a deadline day for me and I only answer the easy questions on deadline day. :) I try to keep messages in the moderation queue so I can find them when I have the time to reply.

      Reply
  20. KoolPal says

    February 20, 2014 at 9:57 am

    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.

    Reply
  21. KoolPal says

    February 20, 2014 at 9:43 am

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

    What else can I check / fix?

    Please help

    Reply
    • Diane Poremsky says

      February 21, 2014 at 12:31 pm

      It sounds like everything should be working. I'm going to check it on VM and see if i can repro.

      Reply
  22. KoolPal says

    February 20, 2014 at 1:49 am

    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?

    Reply
    • Diane Poremsky says

      February 20, 2014 at 1:55 am

      Was it typed correctly? That would be the first thing to double check.

      Reply
  23. KoolPal says

    February 20, 2014 at 12:40 am

    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?

    Reply
    • Diane Poremsky says

      February 20, 2014 at 1:31 am

      It should show up without restarting outlook, but did you try restarting outlook? Did you use the ready to use reg file from the site or type it in?

      Reply
  24. Dominic says

    February 10, 2014 at 5:40 am

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

    Reply
  25. Fabrice says

    September 27, 2013 at 1:29 am

    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

    Reply
    • Diane Poremsky says

      October 10, 2013 at 10:30 pm

      You can't use a view, you need to use instant search to create a unified inbox

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Visit Slipstick Forums.
What's New at Slipstick.com

Latest EMO: Vol. 31 Issue 3

Subscribe to Exchange Messaging Outlook






Support Services

Do you need help setting up Outlook, moving your email to a new computer, migrating or configuring Office 365, or just need some one-on-one assistance?

Our Sponsors

CompanionLink
ReliefJet
  • Popular
  • Latest
  • Week Month All
  • Jetpack plugin with Stats module needs to be enabled.
  • Error Opening iCloud Appointments in Classic Outlook
  • Opt out of Microsoft 365 Companion Apps
  • Mail Templates in Outlook for Windows (and Web)
  • Urban legend: Microsoft Deletes Old Outlook.com Messages
  • Buttons in the New Message Notifications
  • Move Deleted Items to Another Folder Automatically
  • Open Outlook Templates using PowerShell
  • Count and List Folders in Classic Outlook
  • Google Workspace and Outlook with POP Mail
  • Import EML Files into New Outlook
Ajax spinner

Recent Bugs List

Microsoft keeps a running list of issues affecting recently released updates at Fixes or workarounds for recent issues in classic Outlook (Windows).

For new Outlook for Windows: Fixes or workarounds for recent issues in new Outlook for Windows .

Outlook for Mac Recent issues: Fixes or workarounds for recent issues in Outlook for Mac

Outlook.com Recent issues: Fixes or workarounds for recent issues on Outlook.com

Office Update History

Update history for supported Office versions is at Update history for Office

Outlook Suggestions and Feedback

Outlook Feedback covers Outlook as an email client, including Outlook Android, iOS, Mac, and Windows clients, as well as the browser extension (PWA) and Outlook on the web.

Outlook (new) Feedback. Use this for feedback and suggestions for Outlook (new).

Use Outlook.com Feedback for suggestions or feedback about Outlook.com accounts.

Other Microsoft 365 applications and services




New Outlook Articles

Error Opening iCloud Appointments in Classic Outlook

Opt out of Microsoft 365 Companion Apps

Mail Templates in Outlook for Windows (and Web)

Urban legend: Microsoft Deletes Old Outlook.com Messages

Buttons in the New Message Notifications

Move Deleted Items to Another Folder Automatically

Open Outlook Templates using PowerShell

Count and List Folders in Classic Outlook

Google Workspace and Outlook with POP Mail

Import EML Files into New Outlook

Newest Code Samples

Open Outlook Templates using PowerShell

Count and List Folders in Classic Outlook

Insert Word Document into Email using VBA

Warn Before Deleting a Contact

Use PowerShell to Delete Attachments

Remove RE:, FWD:, and Other Prefixes from Subject Line

Change the Mailing Address Using PowerShell

Categorize @Mentioned Messages

Send an Email When You Open Outlook

Delete Old Calendar Events using VBA

Repair PST

Convert an OST to PST

Repair damaged PST file

Repair large PST File

Remove password from PST

Merge Two Data Files

Sync & Share Outlook Data

  • Share Calendar & Contacts
  • Synchronize two computers
  • Sync Calendar and Contacts Using Outlook.com
  • Sync Outlook & Android Devices
  • Sync Google Calendar with Outlook
  • Access Folders in Other Users Mailboxes

Diane Poremsky [Outlook MVP]

Make a donation

Mail Tools

Sending and Retrieval Tools

Mass Mail Tools

Compose Tools

Duplicate Remover Tools

Mail Tools for Outlook

Online Services

Calendar Tools

Schedule Management

Calendar Printing Tools

Calendar Reminder Tools

Calendar Dates & Data

Time and Billing Tools

Meeting Productivity Tools

Duplicate Remover Tools

Productivity

Productivity Tools

Automatic Message Processing Tools

Special Function Automatic Processing Tools

Housekeeping and Message Management

Task Tools

Project and Business Management Tools

Choosing the Folder to Save a Sent Message In

Run Rules on messages after reading

Help & Suggestions

Submit Outlook Feature Requests

Slipstick Support Services

Buy Microsoft 365 Office Software and Services

Visit Slipstick Forums.

What's New at Slipstick.com

Home | Outlook User | Exchange Administrator | Office 365 | Outlook.com | Outlook Developer
Outlook for Mac | Common Problems | Utilities & Addins | Tutorials
Outlook & iCloud Issues | Outlook Apps
EMO Archives | About Slipstick | Slipstick Forums
Submit New or Updated Outlook and Exchange Server Utilities

Send comments using our Feedback page
Copyright © 2026 Slipstick Systems. All rights reserved.
Slipstick Systems is not affiliated with Microsoft Corporation.