The following SEARCH will return items which have been associated with the “Business” category but NOT the “Competition” category in Outlook.
SELECT “DAV:href”, “urn:schemas-microsoft-com:office:office#Keywords”
FROM SCOPE ( ‘SHALLOW TRAVERSAL OF
“DAV:ishidden” = false
“urn:schemas-microsoft-com:office:office#Keywords” != CAST(“Competition” AS ‘mv.string’)
“urn:schemas-microsoft-com:office:office#Keywords” = CAST(“Business” AS ‘mv.string’)
…We don’t seem to have any samples out there that demonstrate how to use a multivalued property in a WHERE clause. I took me a bit to figure this out because the behavior is kind of funny…
Notice that even though we are specifying “=” it behaves similar to a LIKE or CONTAINS query…
Suppose you have two items in a folder Item A with the “Business” category and Item B with “Business” and “Competition”. If this query just had the clause for “Business” then both items would be returned. However, if you use specify that the Keywords must equal “Business” and not equal “Competition” then you only get Item A.