• 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

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.

Subscribe
Notify of
41 Comments
newest
oldest most voted
Inline Feedbacks
View all comments

Adam Williams (@guest_220407)
July 14, 2023 12:50 pm
#220407

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?

0
0
Reply
Jeanine (@guest_220228)
April 17, 2023 7:04 pm
#220228

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

0
0
Reply
Nathan (@guest_218625)
August 13, 2021 5:06 pm
#218625

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!

0
0
Reply
heavymod (@guest_215192)
May 9, 2020 2:38 am
#215192

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

0
0
Reply
Ben (@guest_213971)
September 20, 2019 9:59 am
#213971

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

0
0
Reply
Carsten (@guest_211882)
September 6, 2018 7:18 am
#211882

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

1
0
Reply
Mark (@guest_218532)
Reply to  Carsten
July 13, 2021 10:52 pm
#218532

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

1
0
Reply
Todd (@guest_206671)
May 22, 2017 9:37 pm
#206671

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.

0
0
Reply
Diane Poremsky(@diane-poremsky)
Author
Reply to  Todd
May 23, 2017 12:20 am
#206674

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.

0
0
Reply
Peter (@guest_203181)
December 2, 2016 9:10 am
#203181

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?

0
0
Reply
Diane Poremsky(@diane-poremsky)
Author
Reply to  Peter
March 7, 2017 11:52 pm
#205115

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.

0
0
Reply

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

Latest EMO: Vol. 30 Issue 15

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
  • Use Classic Outlook, not New Outlook
  • How to Remove the Primary Account from Outlook
  • Disable "Always ask before opening" Dialog
  • Adjusting Outlook's Zoom Setting in Email
  • How to Hide or Delete Outlook's Default Folders
  • This operation has been cancelled due to restrictions
  • Remove a password from an Outlook *.pst File
  • Outlook SecureTemp Files Folder
  • Reset the New Outlook Profile
  • Save Attachments to the Hard Drive
  • Count and List Folders in Classic Outlook
  • Google Workspace and Outlook with POP Mail
  • Import EML Files into New Outlook
  • Opening PST files in New Outlook
  • New Outlook: Show To, CC, BCC in Replies
  • Insert Word Document into Email using VBA
  • Delete Empty Folders using PowerShell
  • Warn Before Deleting a Contact
  • Classic Outlook is NOT Going Away in 2026
  • Use PowerShell to Delete Attachments
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

Count and List Folders in Classic Outlook

Google Workspace and Outlook with POP Mail

Import EML Files into New Outlook

Opening PST files in New Outlook

New Outlook: Show To, CC, BCC in Replies

Insert Word Document into Email using VBA

Delete Empty Folders using PowerShell

Warn Before Deleting a Contact

Classic Outlook is NOT Going Away in 2026

Use PowerShell to Delete Attachments

Newest Code Samples

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

Use PowerShell or VBA to get Outlook folder creation date

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 © 2025 Slipstick Systems. All rights reserved.
Slipstick Systems is not affiliated with Microsoft Corporation.

wpDiscuz

Sign up for Exchange Messaging Outlook

Our weekly Outlook & Exchange newsletter (bi-weekly during the summer)






Please note: If you subscribed to Exchange Messaging Outlook before August 2019, please re-subscribe.

Never see this message again.

You are going to send email to

Move Comment