Using ICalendar (.ICS) files for Event Scheduling

Posted on Friday, June 24th, 2011 at 8:20 pm in

Here is a very easy way to schedule events from within your application. This assumes you have a way to send emails with attachments. If you are dealing with a high volumn situation, you may with to write the data to a table and have the database (or some other process) send them out.

The iCalendar format is designed to transmit calendar-based data and is meant “provide the definition of a common format for openly exchanging calendaring and scheduling information across the Internet”. It is supported by a number of products including Outlook, Lotus Notes, Google Calendar, Yahoo Calendar to name a few. See the article on WikipediA for for additional information.

To schedule an event, create and send the following file:

BEGIN:VCALENDAR
VERSION:2.0
METHOD:REQUEST
PRODID:-//MyCompany//MyGreatSoftware//EN
BEGIN:VEVENT
UID:12345
CLASS:PUBLIC
DTSTAMP:20110624T145010
DTSTART:20110628T090000
DTEND:20110628T110000
SUMMARY:Follow Up with Big Customer
LOCATION:Office
ORGANIZER:CN="Smith, Agent" mailto:agent.smith@email.com
PRIORITY:5
SEQUENCE:0
END:VEVENT
END:VCALENDAR

In order to update or cancel a previously entered item you must know the UID and change the SEQUENCE segment. For a cancel, you change the METHOD from REQUEST to CANCEL.

Update previously sent event.

BEGIN:VCALENDAR
VERSION:2.0
METHOD:REQUEST
PRODID:-//MyCompany//MyGreatSoftware//EN
BEGIN:VEVENT
UID:12345
CLASS:PUBLIC
DTSTAMP:20110624T145010
DTSTART:20110628T093000
DTEND:20110628T113000
SUMMARY:Change to Followup with Big Customer
LOCATION:Office
ORGANIZER:CN="Smith, Agent" mailto:agent.smith@email.com
PRIORITY:5
SEQUENCE:1
END:VEVENT
END:VCALENDAR

To Cancel an event.

BEGIN:VCALENDAR
VERSION:2.0
METHOD:CANCEL
PRODID:-//MyCompany//MyGreatSoftware//EN
BEGIN:VEVENT
UID:12345
CLASS:PUBLIC
DTSTAMP:20110624T145010
DTSTART:20110628T093000
DTEND:20110628T113000
SUMMARY:Cancel Follow up with Big Customer
LOCATION:Office
ORGANIZER:CN="Smith, Agent" mailto:agent.smith@email.com
PRIORITY:5
SEQUENCE:1
END:VEVENT
END:VCALENDAR

Note the Organizer doesn’t have to be a valid email address. Outlook allows you to look at appointments in .ics format which can give you some further insight into the process (how to set reminders and such). Note that not all applications will recognize all atributes of the .ics file.

You might also be interested in

Add your comment

Leave a Reply

Top