rehannali

Raw Query Filter Outlook Mac

Jan 30th, 2023
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!

Perform OR queries for categories on Microsoft Outlook for Mac

Bizarrely, one cannot make OR queries in Microsoft Outlook for Mac, at least not easily.
For example, I want a smart folder that contains all messages tagged with either the FIS Broker category or the Dubletten category.

The way to do it non-easily is to select Raw Query as the query rule type (in Search > Advanced), and then enter a Spotlight query string.
The attribute to query for categories is com_microsoft_outlook_categories.
That attribute takes a numeric id - but what the hell is the id for a category like FIS Broker?
Outlook doesn't tell me, so I have to go even deeper down the rabbit hole.
Here is how:

  • Tag a message with a sufficiently unique message title with the categories you're interested in (e.g., FIS Broker and Dubletten).
  • On the commandline, navigate to the folder that contains the raw MS Outlook messages:
$ cd ~/Library/Group Containers/UBF8T346G9.Office/Outlook/Outlook 15 Profiles/Main Profile/Data/Messages
  • Grep for the title of the message to find the file that contains it:
$ grep -r -i "A sufficiently unique message title" ./*
Binary file ./11/0B2132B7-999F-4114-AC6C-E93DE72CEF9A.olk15Message matches
Binary file ./156/9C6C3E09-C2A3-42CE-A5EF-CEAB70865FC5.olk15Message matches
  • Now run the mdls command on that file to find the attached Spotlight metadata:
$ mdls ./11/0B2132B7-999F-4114-AC6C-E93DE72CEF9A.olk15Message
  • You'll get a long list of metadata. For our com_microsoft_outlook_categories attribute we get something like:
com_microsoft_outlook_categories               = (
    87,
    86
)
  • So there we have our category ids!
  • Finally, the raw Spotlight query to match all messages tagged with either one of these categories and put them in a smart folder is:
com_microsoft_outlook_categories == 86 || com_microsoft_outlook_categories == 87

Sources:

  • http://xensoft.com/search-mac-outlook-2011-mail-with-raw-queries/
  • https://superuser.com/questions/1388473/how-does-one-find-possible-values-for-com-microsoft-outlook-categories-in-outloo
Add Comment
Please, Sign In to add comment