Outlook e-mail Raw Queries

How do you create raw queries?

In outlook for MacOS you have to jump through a few hoops.

  1. Click on the Search Bar: this will then open the search ribbon to allow you to select other options. For some reason, unless you click on the search field they hide this ribbon to make it extremely inconvenient for you to do anything.
  2. Click ‘Advanced’ on the search ribbon.
  3. Select ‘Raw Query’
  4. Enter your Raw Query and save the search. It will then appear in your smart folders.

What is the syntax and parameters of a raw query?

This information is not as easy to find and doesn’t appear to be officially documented anywhere. On a Mac you can run this from the command line and in the main outlook profile data directory

1
2
3
cd ~/Library/Group Containers/UBF8T346G9.Office/Outlook/Outlook 15 Profiles/Main Profile/Data/Messages
# Choose any of the folders and find an olk15Message file.
mdls <filename>

The results will show you the metadata available for searching in that particular message.