playing with fire

We have a proposal due soon for a company who’s asking for a sort of calendar integration.  I know that MS Outlook, as well as Thunderbird and other random email readers can accept files called ICS (iCalendar Calendar Data) which is a standard calendar file format that Apple created a long time ago.  The cool thing about that is, for once I have a standard to work with.  The other cool thing is there’s a mime type set up ‘text/calendar’ which also makes things easy.  This leads me to believe that I can create a file within a set of standards that can be downloaded or opened using the coldfusion cfcontent tag.

To build your calendar code, of course there are certain things you actually have to include in your file.  You must start at the beginning with a simple ‘BEGIN:VCALENDAR’.  You’ll finish up, of course, with ‘END:VCALENDAR’.  What you do in between, that will determine what type of calendar event it is (event, journal, to do etc).  You will of course need some basic core ingredients.  You need to send in the version, a product id, a start and stop date/time and a summary of the item.  You might also want to add in the timezone information as well.

For a basic example, we just want to create an event that happens once, beginning today, and ending today, like, lets say, it’s my birthday.

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//myprodid//whatever//EN
BEGIN:VEVENT
DTSTART:20080709T000001Z
DTEND:20080709T235959Z
SUMMARY:Amy's Birthday
END:VEVENT
END:VCALENDAR

So we create this as a sort of text file format (don’t forget CRLF after each line) and display to the screen via cfcontent and cfheader, and voila, a coldfusion icalendar object that the user can download and open in their email client of choice.