Hey All,
I’m trying to get all of the calendar events from outlook (old version where AppleScript still works) that occur today. Code I’ve got so far is below. For non recurring events it’s working fine. For recurring events I cannot figure out the correct way of structuring my code to interrogate the recurrence end date property.
I basically need help doing 2 things:
- Guidance on how to access the end date property of the recurrence (screens attached for structure)
- Very much a secondary but if possible in AppleScript great, work out if the final version of the recurrence is in the future or not. Simple for those with an end date but much more complex for those with custom types (occurs every Thursday and ends after 10 occurrences).
tell application "Microsoft Outlook"
set currentDate to current date
set startOfDay to currentDate - (time of currentDate) -- Set the time to 00:00
set endOfDay to startOfDay + 1 * days
set allEventsToday to (every calendar event whose (start time ≥ startOfDay and start time < endOfDay))
--set recurringEvents to (every calendar event whose recurrence is not missing value)
set meetingsList to {}
repeat with aMeeting in allEventsToday
set startTime to start time of aMeeting
set endTime to end time of aMeeting
set meetingTitle to subject of aMeeting
set attendeesCount to count of attendees of aMeeting
set meetingDetails to {startTime, endTime, meetingTitle, attendeesCount} as string
set end of meetingsList to meetingDetails
end repeat
set recurringEvents to (every calendar event whose is recurring is true)
repeat with aRecurringEvent in recurringEvents
set occurenceType to recurrence of aRecurringEvent
try
set recurrenceEndType to end type of recurrence of aRecurringEvent
if recurrenceEndType is "no end type" then
set meetingTitle to subject of aRecurringEvent
set meetingDetails to {meetingTitle} as string
set end of meetingsList to meetingDetails
end if
on error errMsg number errNum
log "Error with event id " & id of aRecurringEvent & ": " & errMsg
end try
end repeat
end tell
return meetingsList
Thanks,
Pete