I'm having a problem with Microsoft Outlook for Mac changing UIDs of events that I create through AppleScript. I am creating an event in outlook and noting it's UID so that I can later revisit it and update it. However the issue I'm having is that when I search for the calendar entry to update it appears the UID has been changed. Applescript to create an event:
on run argv
tell application "Microsoft Outlook"
set the_calendar to item 1 of argv
set the_name to item 2 of argv
set the_content to item 3 of argv
set theTimeZone to item 8 of argv
set start_datetime to current date -- setting this as a placeholder so we get the type as date
set end_datetime to current date -- setting this as a placeholder so we get the type as date
tell start_datetime to set {its year, its month, its day} to words of item 4 of argv
tell start_datetime to set {its hours, its minutes, its seconds} to words of item 5 of argv
tell end_datetime to set {its year, its month, its day} to words of item 6 of argv
tell end_datetime to set {its hours, its minutes, its seconds} to words of item 7 of argv
set newEvent to make new calendar event with properties {subject:the_name, content:the_content, start time:start_datetime, end time:end_datetime, timezone:{name:theTimeZone}}
--return id of newEvent
return {id, icalendar data} of newEvent
end tell
end run
As an example for that being called with params:
116 another new one 2022-09-26 09:00:00 2022-09-26 09:15:00 Europe/London
My script then returns the following ical information:
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Microsoft Corporation//Outlook for Mac MIMEDIR//EN
METHOD:PUBLISH
BEGIN:VTIMEZONE
TZID:Dublin, Edinburgh, Lisbon, London
X-ENTOURAGE-CFTIMEZONE:Europe/London
X-ENTOURAGE-TZID:8
BEGIN:STANDARD
RRULE:FREQ=YEARLY;INTERVAL=1;BYSECOND=0;BYMINUTE=0;BYHOUR=2;BYDAY=-1SU;BYM
ONTH=10
TZOFFSETFROM:+0100
TZOFFSETTO:+0000
DTSTART:16011001T020000
END:STANDARD
BEGIN:DAYLIGHT
RRULE:FREQ=YEARLY;INTERVAL=1;BYSECOND=0;BYMINUTE=0;BYHOUR=1;BYDAY=-1SU;BYM
ONTH=3
TZOFFSETFROM:+0000
TZOFFSETTO:+0100
DTSTART:16010301T010000
END:DAYLIGHT
END:VTIMEZONE
BEGIN:VEVENT
UID:32C77928-016E-42D3-9703-8397F5D43257
X-ENTOURAGE_UUID:32C77928-016E-42D3-9703-8397F5D43257
DTSTAMP:20220919T055852Z
DTSTART;TZID="Dublin, Edinburgh, Lisbon, London":20220926T090000
DTEND;TZID="Dublin, Edinburgh, Lisbon, London":20220926T091500
LAST-MODIFIED:20220919T055852Z
SUMMARY:another new one
ORGANIZER:MAILTO:123@gmail.com
SEQUENCE:0
X-MICROSOFT-CDO-BUSYSTATUS:BUSY
X-MICROSOFT-CDO-ALLDAYEVENT:FALSE
X-MICROSOFT-DISALLOW-COUNTER:FALSE
X-MICROSOFT-DONOTFORWARDMEETING:FALSE
X-MICROSOFT-CDO-INSTTYPE:0
BEGIN:VALARM
ACTION:DISPLAY
DESCRIPTION:REMINDER
TRIGGER;RELATED=START:-PT00H15M00S
END:VALARM
END:VEVENT
END:VCALENDAR
Notice: UID:32C77928-016E-42D3-9703-8397F5D43257.
When I then search for that calendar entry using the following code I see that the UID has been changed.
Search code:
tell application "Microsoft Outlook"
set theCal to calendar id 116
set theTitle to "another new one"
set existingEvents to get (calendar events of theCal whose its subject is theTitle)
repeat with eachEvent in existingEvents
the subject of eachEvent
end repeat
end tell
This will then display:
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Microsoft Corporation//Outlook for Mac MIMEDIR//EN
METHOD:PUBLISH
BEGIN:VTIMEZONE
TZID:Dublin, Edinburgh, Lisbon, London
X-ENTOURAGE-CFTIMEZONE:Europe/London
X-ENTOURAGE-TZID:8
BEGIN:STANDARD
RRULE:FREQ=YEARLY;INTERVAL=1;BYSECOND=0;BYMINUTE=0;BYHOUR=2;BYDAY=-1SU;BYM
ONTH=10
TZOFFSETFROM:+0100
TZOFFSETTO:+0000
DTSTART:16011001T020000
END:STANDARD
BEGIN:DAYLIGHT
RRULE:FREQ=YEARLY;INTERVAL=1;BYSECOND=0;BYMINUTE=0;BYHOUR=1;BYDAY=-1SU;BYM
ONTH=3
TZOFFSETFROM:+0000
TZOFFSETTO:+0100
DTSTART:16010301T010000
END:DAYLIGHT
END:VTIMEZONE
BEGIN:VEVENT
UID:040000008200E00074C5B7101A82E00800000000F1FB53E5ECCBD80100000000000000
0010000000732F1FFEB492A14C86170F6940FD7E4D
X-ENTOURAGE_UUID:32C77928-016E-42D3-9703-8397F5D43257
X-MICROSOFT-EXCHANGE-ID:AQMkAGM4YzkwMAItNDkwNi0xYTYwLTAwAi0wMAoARgAAA4dYA3
WZ7wtPubkA4F2cDA3rBwAQdl8jZ5nbQI1VWqJLfBXKAAACAQ0AAAAQdl8jZ5nbQI1VWqJLfBXK
AAAAp9VvwQAAAA==
X-MICROSOFT-EXCHANGE-CHANGEKEY:EHZfI2eZ20CNVVqiS3wVygAAp7OZgw==
DTSTAMP:20220919T085323Z
DTSTART;TZID=\"Dublin, Edinburgh, Lisbon, London\":20220926T090000
DTEND;TZID=\"Dublin, Edinburgh, Lisbon, London\":20220926T091500
LAST-MODIFIED:20220919T085323Z
SUMMARY:another new one
ORGANIZER:MAILTO:123@gmail.com
SEQUENCE:0
X-MICROSOFT-CDO-BUSYSTATUS:BUSY
X-MICROSOFT-CDO-ALLDAYEVENT:FALSE
X-MICROSOFT-DISALLOW-COUNTER:FALSE
X-MICROSOFT-DONOTFORWARDMEETING:FALSE
X-MICROSOFT-CDO-INSTTYPE:0
BEGIN:VALARM
ACTION:DISPLAY
DESCRIPTION:REMINDER
TRIGGER;RELATED=START:-PT00H15M00S
END:VALARM
END:VEVENT
END:VCALENDAR
Notice here UID is now UID:040000008200E00074C5B7101A82E00800000000F1FB53E5ECCBD80100000000000000 0010000000732F1FFEB492A14C86170F6940FD7E4D.
However the X-ENTOURAGE_UUID is still the same: X-ENTOURAGE_UUID:32C77928-016E-42D3-9703-8397F5D43257
Does anyone know what causes this and how to stop it happening?
I guess my options here are:
- Figure out what is causing this and fix it
- Switch over to using X-ENTOURAGE_UUID to identify calendar items requiring changes. I'm not sure what the advantages or disadvantages of this would be
- Adjust approach so that I generate the ics files myself, including generating my own UID, and then importing those to outlook rather than telling outlook to create the calendar entries for me.
Additional info about the calendar, if useful:
- It is a gmail calendar that I manage through outlook