Download your favorite Linux distribution at LQ ISO.
Go Back > Blogs > catkin
User Name


Rate this Entry

Exporting Outlook calendar as .ical/ics

Posted 05-13-2011 at 07:36 AM by catkin
Tags ical, ics, outlook


This falls into two steps: firstly exporting an Outlook calendar as .ical files and secondly turning those .ical files into a .ics file.

The technique was used with Outlook 2003 running on Windows XP (as part of a migration to Xfce's calendar, Orage). It probably works with other versions and OSes too.

Thanks and acknowledgements to BlueDevilFan who posted the original VBA macro at Experts Exchange where it is no longer visible (but may be after subscribing).

In Outlook ...

Tools → Macro → Security and note the Security Level for later restore. Set the Security Level to Medium.

Tools → Macro → Visual Basic Editor. If Modules/Module1 is not displayed, right-click" Project1" then "Insert Module". Open Modules/Module1. In the VBA editor, in Module1, create this macro, changing <drive>:<path> as required (best use an empty folder):
Sub ExportToiCal()
    Dim olkFolder As Outlook.Items, _
        olkAppointment As Outlook.AppointmentItem, _
        intCount As Integer
    intCount = 1
    Set olkFolder = Application.ActiveExplorer.CurrentFolder.Items
    For Each olkAppointment In olkFolder
        'Edit the path and filename on the following line as needed
        olkAppointment.SaveAs "<drive>:<path>\Appt-" & intCount & ".ical", olICal   'or olVcal if you prefer
        intCount = intCount + 1
    Set olkAppointment = Nothing
    Set olkFolder = Nothing
    MsgBox "All done."
End Sub
In Outlook, open the Calendar then Tools → Macro → Macros. If you get a Security Warning, click Enable Macros. Select ExportToiCal and click Run. Depending on the system it will take around 1 minute per 200 calendar entries. The GUI may flicker and develop empty rectangles while the macro is running.

When ExportToiCal has finished: Tools → Macro → Security and restore the original Security Level.

The individual Appt-<n>.ical files may now be turned into a .ics file by simple concatenation. This may be done on a Linux-based system by:
cat Appt-*.ical > Appt-all.ics
Outlook-specific data can be removed by:
sed '/^ATTACH/ d' Appt-all.ics | sed '/^PRODID/ d' | sed '/X-MICROSOFT/ d' > Appt-all.filtered.ics
Posted in Uncategorized
Views 2300 Comments 0
« Prev     Main     Next »
Total Comments 0




All times are GMT -5. The time now is 06:04 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration