LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Blogs > catkin
User Name
Password

Notices


Rate this Entry

Exporting Outlook calendar as .ical/ics

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

Hello

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):
Code:
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
    Next
    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:
Code:
cat Appt-*.ical > Appt-all.ics
Outlook-specific data can be removed by:
Code:
sed '/^ATTACH/ d' Appt-all.ics | sed '/^PRODID/ d' | sed '/X-MICROSOFT/ d' > Appt-all.filtered.ics
Posted in Uncategorized
Views 3156 Comments 0
« Prev     Main     Next »
Total Comments 0

Comments

 

  



All times are GMT -5. The time now is 09:12 AM.

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