Created
October 9, 2015 14:04
-
-
Save talkingmoose/f3a21b2c1ba26ade658d to your computer and use it in GitHub Desktop.
Export events from all calendars in Outlook for Mac to individual .ics files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tell application "Finder" | |
set tmpFolder to "Outlook Calendars" | |
try | |
set tmpLocation to make new folder with properties {name:tmpFolder} at path to desktop | |
on error | |
set tmpLocation to folder tmpFolder of folder (path to desktop) | |
end try | |
end tell | |
tell application "Microsoft Outlook" | |
set theCalendars to every calendar | |
end tell | |
repeat with aCalendar in theCalendars | |
tell application "Microsoft Outlook" | |
set calendarName to name of aCalendar | |
try | |
set calendarAccount to name of account of aCalendar | |
on error | |
set calendarAccount to "On My Computer" | |
end try | |
tell application "Finder" | |
try | |
set calendarFolder to make new folder with properties {name:calendarName & " (" & calendarAccount & ")" as string} at tmpLocation | |
end try | |
end tell | |
set eventsList to every calendar event of aCalendar | |
repeat with anEvent in eventsList | |
set eventDetails to icalendar data of anEvent | |
set eventID to id of anEvent | |
set eventFile to eventID & ".ics" as string | |
tell application "Finder" | |
try | |
set fileReference to open for access file ((calendarFolder as string) & eventFile as string) with write permission | |
write eventDetails to fileReference | |
close access fileReference | |
end try | |
end tell | |
end repeat | |
end tell | |
tell application "Calendar" | |
-- set newCalendar to create calendar with name calendarName | |
end tell | |
end repeat | |
display dialog "Successfully exported " & (count of theCalendars) & " calendar folders to a temporary folder on your Desktop. Open each calendar folder and drag all .ics files into your Google account calendar in Apple Calendar." with title "Export Complete" buttons {"Show Calendars"} default button {"Show Calendars"} | |
tell application "Finder" | |
activate | |
open tmpLocation | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment