Has anybody been able to make a repeating calendar event in Microsoft Outlook?
The syntax is quite complicated with records within records.
I tried with the code below, but I get the error:
Microsoft Outlook got an error: Can’t make {start date:date “Monday, March 1, 2021 at 2:58:17 AM”, end date:date “Wednesday, March 31, 2021 at 2:58:17 AM”, recurrence type:“weekly”, occurrence interval:1, days of week:{monday:true}} into type recurrence or missing value.
set startTime to (current date) + (18 * days)
set endTime to startTime + (80 * minutes)
set endDate to startTime + (30 * days)
set theWeekday to weekday of startTime
tell application "Microsoft Outlook"
tell calendar "Untitled Folder"
make new calendar event with properties {subject:"Test", location:"1000", start time:startTime, end time:endTime, has reminder:false, recurrence:{start date:startTime, end date:endDate, recurrence type:"weekly", occurrence interval:1, days of week:{monday:true}}}
end tell
end tell
Add a normal event with AppleScript then you have the event ID, then modify this event manually and read this event with properties back with AppleScript, then you have the correct syntax:-)
I’ll experiment with your idea, though my confidence is not high. I think I may have already tried that.
I have since come up with a workaround. Since the event in question was an office account, I added this account to Apple Calendar and used the AppleScript dictionary there to modify it in a recurring event.
I think my final script will end up using the libraries/dictionaries from Microsoft Outlook, Apple Calendar, and CalendarLib EC. Each dictionary has an ability that the other two don’t.
The Microsoft Outlook dictionary is good for creating calendars and events that live on the office server.
The Apple Calendar dictionary is good for modifying events into recurring events.
The CalendarLib EC dictionary is good for modifying the time zone.
This is a sample code from an early test from last year.
set EXPOID to 35
set mystartdate to date "Freitag, 19. Juni 2020 um 16:20:00"
set myEnddate to date "Freitag, 19. Juni 2020 um 17:20:00"
set NewCal to "no"
set myUUID to ""
tell application "Microsoft Outlook"
if EXPOID is equal to "" then
set NewCal to "yes"
else
set myList to every calendar event whose (id is EXPOID)
if myList is {} then
set NewCal to "yes"
end if
end if
if NewCal is equal to "yes" then
set myEvent to make new calendar event
tell myEvent
try
set plain text content of myEvent to "Textchen
2- Zeile
Eigentümer:
Sorglos, Susi
"
set subject of myEvent to "Titel3"
set location of myEvent to "Ortchen"
set start time of myEvent to mystartdate
set end time of myEvent to myEnddate
set recurrence of myEvent to {end date:{end type:end numbered type, data:3}, start date:mystartdate, occurrence interval:2, recurrence type:daily}
set myUUID to id of myEvent
end try
end tell
set myUUID to id of myEvent
else
repeat with myEvent in myList
try
set plain text content of myEvent to "Textchen
2- Zeile
Eigentümer:
Sorglos, Susi
"
set subject of myEvent to "titel55"
set location of myEvent to "Ortchen"
set start time of myEvent to mystartdate
set end time of myEvent to myEnddate
set recurrence of myEvent to {end date:{end type:end numbered type, data:8}, start date:mystartdate, occurrence interval:1, recurrence type:daily}
set myUUID to id of myEvent
end try
end repeat
end if
return myUUID --uid of myEvent
save
end tell
Armin
I got the syntax by reading an recurring event back with applescript.