Psyked*
it’s easy once you know how.Creating Outlook Calendar events through hyperlinks
Posted by James - 07/08/08 at 11:08:02 pmYou mightn’t think it was possible, the lack of implimentations you see for it on a day-to-day basis, but actually you can create Calendar events for a wide range of email / organiser clients using the iCalendar file format.
From the users’ point of view, your Calendar event appears as every other hyperlink does in your html pages – but when they click on the link, instead of being taken to a new page, Outlook opens up an ‘add event’ just as if they’d clicked on a meeting request (in Outlook).
From the developers’ point of view, once you have your server configured correctly, it’s just a case of creating and linking to an .ics file instead of a .htm file – at which point the client’s email software should take over.

Does it work for me?
I don’t know – try clicking on this link. If MIME types are incorrectly set you’ll probably see a plain text file, and if you don’t have an application setup that’s compatable with iCalendar events, you’ll probably just be asked to save the file to your hard drive.
How do you create a Calendar event then?
First up, you need to sort out your MIME-types. I’m not going into that because it can get a little too complex, but just make sure you have the file extension .ics registered under the MIME-type “text/calendar” – if you’re lucky it might already be setup!
Next, you need to make the actual file, which is simple in one sense and complex in another. iCalendar files are plain text files, so you just need notepad or something to create them, but they do have a very specific format. Wikipedia has a very simple example, so we’re going to use that as a basis for our sample file.
So lets create a working example – and we’ll use the Flash on the Beach conference as a basis.
This is the example on Wikipedia;
BEGIN:VCALENDAR VERSION:2.0 PRODID:-//hacksw/handcal//NONSGML v1.0//EN BEGIN:VEVENT DTSTART:19970714T170000Z DTEND:19970715T035959Z SUMMARY:Bastille Day Party END:VEVENT END:VCALENDAR
The framework we need to keep is pretty self explanitory – there’s elements like the beginning and ending of portions of the file, and a basic framework for the dates and summary. According to the RFC iCalendar specification, VERSION and PRODID are both required, so we’ll leave those in also – which just leaves us with some customizing to do on the dates and summary information;
BEGIN:VCALENDAR VERSION:2.0 PRODID:-//hacksw/handcal//NONSGML v1.0//EN BEGIN:VEVENT DTSTART:20080928T000000Z DTEND:20081001T000000Z SUMMARY:Flash on the Beach 08 Conference DESCRIPTION:Flash on the Beach 08 is here again! Wow, Flash on the Beach is in it's third year already! FOTB06 was awesome, FOTB07 was even better, and we are now pulling out all the stops to make FOTB08 the best yet! We have the best talent around speaking, new speakers to FOTB, the Inspired Sessions, workshops, parties and more! It's gonna rock! END:VEVENT END:VCALENDAR
You can see that there’s practically no special formatting for the actual content – just plain text. (Which is a shock after working with XML and CDATA for so long.) And date formatting is just a condensed string – 1/11/2008, 15:30:00 just becomes 20081101T153000Z.
Whack that into notepad, change the file extension to .ics and you’re away!
That’s it?
That really is it. It’s an incredibly easy thing to customize – I’d really recommend you skim through the spec for iCalendar if you’re thinking of doing more clever things – there’s formats and properties that control priorities, due dates, durations, status, alarms, journal entries – practically everything that Outlook does (beyond emails) can be done with the iCalendar format.



Subscribe to the RSS feed

You may want to check your example “icalendar.ics” file. It won’t open in Apple’s iCal.
Comment by Nathan McCance — 29 August 2008 #
Great stuff… how would you add other invitees automatically?
Comment by blackock — 6 October 2008 #
So far as I can tell from the spec, you can add people with the ATTENDEE element, in which you can put a list of all the people (and email addresses) that you want to attend.
e.g.
ATTENDEE;DELEGATED-FROM=”MAILTO:jsmith@host.com”:MAILTO:jdoe@host.com
ATTENDEE;DELEGATED-TO=”MAILTO:jdoe@host.com”,”MAILTO:jqpublic@host.com”:MAILTO:jsmith@host.com
ATTENDEE;MEMBER=”MAILTO:ietf-calsch@imc.org”:MAILTO:jsmith@host.com
Obviously there’s no way for a simple text-based file to know who’s attending dynamically, but you can specify some initial persons – or power the whole thing with a server side solution.
Comment by James — 7 October 2008 #
Does not work in outlook 2003
errors with
This error can appear if you have attempted to save a recurring Lunar appointment in iCalendar format.
To avoid this error, set the appointment option to Gregorian instead of Lunar
Comment by Lesta G — 6 November 2008 #
If you want to take full advantage of the features offered via an .ics file, create the event while in Outlook and then save the event as an .ics file. That way you can include the a list of attendees and any other feature available via an Outlook event. Makes a “No Brainer” of the process of creating an .ics file.
Comment by Dave Ramsey — 14 May 2009 #
Hey Lesta G,
Did you fian a fix to to problem you stated? I am having same problem. ANy help will be greatly appriciated.
Thanks
Comment by varumr — 5 June 2009 #