I'm trying to write an Applescript on OSX to filter Outlook for Mac 2011 calendar events based on event categories, e.g. find all events tagged as "Conference". For example, I have a calendar event named "WWDC" that is found by the following script:
tell application "Microsoft Outlook"
set theCategoryConference to first category whose name is "Conference"
set theConferenceList to every calendar event whose (subject is "WWDC")
display dialog "There were " & (count of theConferenceList) & " Conferences."
set theEvent to item 1 of items of theConferenceList
display dialog "Categories contains conference: " & (categories of theEvent contains {theCategoryConference})
end tell
The above finds 1 event, and the final line displays "true" as this event has been tagged with the Conference category.
However what I really want to do is find all such events. The following fails to match any events:
set theConferenceList to every calendar event whose categories contains {theCategoryConference}
Is there a different syntax to use, or is this a limitation of Outlook for Mac that perhaps doesn't allow filtering events based on a nested collection (the categories
attribute on calendar event
objects)?
See Search Outlook contacts by category
Here we use the spotlight/
mdfind
/mdls
workaround to find all the relevant categorized events.