Fri, 10 Aug 2007

Adding Outlook/Exchange Invitations to Google Calendar from mutt

If you work with people, you have probably received meeting requests from MS Outlook/Exchange users. I used to add these to KOrganizer using korganizerIn, but I stopped using KOrganizer a long time ago, and I've been pretty happy using Google Calendar for a while. My goal was to add meeting requests to my Google Calendar. The OpenSync library provides the means for moving events between different calendar formats, and multisync-tools provide a command-line interface to the OpenSync library.

Install and configure multisync-tools.

# apt-get install multisync-tools opensync-plugin-google-calendar opensync-plugin-file
$ mkdir ~/calendar
$ echo "text/calendar;~/bin/addCalendarItem %s; needsterminal;" >> ~/.mailcap
$ msynctool --addgroup file-google
$ msynctool --addmember file-google file-sync
$ msynctool --addmember file-google google-calendar
$ msynctool --configure file-google 1

Change the contents of the <path> tag.
$ msynctool --configure file-google 2
Replace with your Google username and PASSWORD with your password.

Create ~/bin/addCalendarItem:


echo loading $1;
cp $1 `tempfile -d ~/calendar`
msynctool --sync file-google 2> /dev/null

Now when you get a meeting request in mutt, you can view-attachments, then view-attach (<Return>) on the meeting.ics attachment, and the meeting will be added to your Google calendar. It's not perfect. No acceptance notifications are sent. If you view a meeting request multiple times, it will be added to the calendar multiple times. Sometimes the synchronization hangs, and when you try it again, it detects conflicts between what's in your calendar directory and your Google calendar, and you have to tell it which to keep.

If I ever get the motivation, I might write a script to just add events using the Google Calendar API since I don't really need two-way synchronization.

Thanks to Trond for getting me started.

tech | Permanent Link

The state is that great fiction by which everyone tries to live at the expense of everyone else. - Frederic Bastiat