in Ruby, Standards

Exporting Exchange calendars to Apple iCal over HTTP and WebDAV

Update: This code has been integrated and greatly enhanced in the rexchange project by Sam Smoot. Update 2: iCal in Lion supports Exchange and none of this should be required anymore.

Having recently recieved a brand new MacBook Pro from my employer I needed to get basic things such as mail and calendaring working. We use Microsoft Exchange 2003 which is great if everyone is using Outlook. Since I work with various clients I am subjected to their respective firewall policy which typically only allows HTTP(S) traffic. This leaves us with Outlook Web Access (dumbed down interface for everyting but IE). Reading e-mail works fine in OWA. However, the calendar becomes useless as reminders won’t appear.

Unfortunately, Apple’s iCal doesn’t work with Exchange. iCal does, however, store data in the standard icalendar format. Having som experience working with WebDAV access to Exchange (which is available if you can reach OWA) I decided to write an Exchange API in Ruby to read calendar items and convert these to the icalendar format. So, I was about half-way through when I discovered that Sam Smoot had created RExchange. That gave me most of the API:s required for connecting to Exchange.

RExchange did not contain a class for working with appointments (only mail and contacts), so I had to add that. Also, RExchange uses the Time::parse method to convert strings to time representation which doesn’t work for dates after 2037.

Anyway, to export your Exchange calendar to iCal through WebDAV, download the rexport script, unpack the files and modify the rexchange.rb file with your login credentials and OWA URL. Execute rexchange.rb from the terminal. It will create an iCal storage file corestorage.ics in the same directory. This can be opened directly in iCal.

Future options may include a synchronization mode. Suggestions and patches are welcome.

  1. Hey! It works! I now have a separate iCal calendar to which I download my exchange calendar twice a day. Thank you!

  2. I guess the obvious next question is how to get my iCal to update
    the Exchange calendar. I’m willing to help if you have an idea for
    an approach.

  3. Dan: If you want to help out, have a look at the rexchange project and try to add update methods there. That would make it a lot easier to build synchronization between iCal and Exchange.

    John: No. I think you may be looking for something else.

  4. Sorry this is months after the fact, but I just found this post and think this is a great idea. Your script isn’t working for me though. I get a `method_missing’: undefined method `calendar’ when I run it. Any advice?

Comments are closed.