I have reason to want an exchange calendar sync’d to my blackberry. Problem being, the blackberry is not on that exchange server’s enterprise services and blackberry internet service doesn’t sync calendars.
Happily, Office Online offers the ability to publish calenders in an icalendar format. With Google Sync for Blackberry and Google Calendar I could subscribe and sync to my blackberry.
At some point, this broke.
Unhappily, it appears the Office Online feed has started failing in Google’s icalendar parser. It also fails in the iCalendar Validator by Steven N. Severinghaus.
Google has just released an Outlook add-in to sync calendars but I have restricted permissions to install software on my Outlook pc. So, I decided to try to solve this on my own.
Using http rather than webcal iCalendar Validator was able to flag the following:
Error: Error was: Error at line 68: Unparseable date: "2"
Looking in the feed, I found word wrapping breaking dates and guids:
EXDATE;TZID="GMT -0500 (Standard) / GMT -0400 (Daylight)":20090316T140000,2
0090323T140000
After finding other services that could parse the feed but none that would sync over the wire to my blackberry calendar, I wrote a short php script to make the feed comply with Google’s parser.
<?php
//request the icalendar file
$output = file_get_contents('http://[path to calendar ics file]');
//clean up the icalendar content
$output = preg_replace("/[\n|\r]+\t/m", "", $output);
//print out the result
echo $output;
?>
Now I can subscribe to the calendar via my script’s URL and google reads and syncs it to my blackberry. Happiness for now – at least until this kludge train derails again.