我正在使用Outlook 2011 for Mac。
我们的想法是将所有日历事件标记为“X123”作为主题,并添加一个新类别:类别“Blabla”。通过此更改,我还想删除旧类别(如果有)。
我从Ramon's topic获得了一个小片段(谢谢!),但有人可以帮助我,因为问题有点不同。
这就是我现在所得到的:
tell application "Microsoft Outlook"
set theCategory to first category whose name is "Blabla"
set theEventList to every calendar event whose (subject is "X123")
display dialog "There are " & (count of theEventList) & " Events."
set theEvent to item 1 of items of theEventList
set currentIdentityFolder to quoted form of POSIX path of (current identity folder as string)
set cmd to "mdfind -onlyin " & currentIdentityFolder & " 'kMDItemContentType == com.microsoft.outlook14.event && com_microsoft_outlook_categories == " & id of theCategory & "' | xargs -I % mdls -name com_microsoft_outlook_recordID '%' | cut -d'=' -f2 | sort -u | paste -s -"
set theEventIDs to words of (do shell script cmd)
set theCategory to {}
repeat with thisEventID in theEventIDs
-- set the new category
set theCategory to category "Blabla"
display dialog "test"
end repeat
end tell
答案 0 :(得分:0)
谢谢ShooTerKo。我从天才那里得到了一些帮助。这段AppleScript就是我自己的问题的答案:
tell application "Microsoft Outlook"
set theCategory to category "Blabla" -- theCategory = "Blabla"
set theEventList to every calendar event whose subject contains "X123" -- theEventList contains "X123"
-- Loop through each event
repeat with theEvent in theEventList
set category of theEvent to {} -- Empty all other categories
set category of theEvent to {theCategory} -- Set the new category to theCategory
end repeat
end tell