Get all Outlook Mail Messages without any categories


I am trying to extract all mail messages without any category assigned to them from my Outlook, but I can only get it to work if I filter for a specific category, like “[categories] = ‘red category’”


But what I want is the opposite: to get all the mail messages that have no category.

Could anyone help me?

Hi @apietens
remove the filter option and try to get all mail messages
and loop it through for each item in Mails

and get all the mails

Ashwin S

Can you try this @apietens

“[categories] =‘Blue category’”

Hi @AshwinS2,

Thank you. I have done that and that works, but i’d rather have it filtered straightaway. So if you have any solution for that, i’d like to know.

Hi there…I have the same problem and its proving impossible to resolve with an elegant solution.
Please could you share the logic of your loop solution . I need to get rid of any mails that have any Catagory assigned ie I only want the blank or unassigned ones…

this simple filter works perfectly…
“Not [categories] > 0” in the filter expression…

…but not in all environments. Migrated my xaml to the work environment and the filter broke…

…found a robust solution in Microsoft DASL documentation: this is the exact filter string required:
“@SQL=” & Chr(34) & _
“urn:schemas-microsoft-com:office:office#Keywords” & _
Chr(34) & " is null"