Creating Calendar Items

It is nice to be able to allow team mates to optionally add meeting requests or reminders to their calendars through an informational email or web page. For example, if you have a website showing information on how team members can run a stress tool on their PC at night, you may want to provide a link which will add a reminder to their calendar.

 

Most calendar applications support the iCalendar standard, defined by RFC 2445 (wiki), which are files with the ".ICS" extension. Using this file format you can easily (and even programmatically) create events which are added into associates’ calendars. Making it easy for people to help you out is important, as you will want to remove as many barriers as possible to improve the participation on things like stress, bug bashes, etc.

Calendar Entry

So let’s take a look at a simple “hello world” sample:

BEGIN:VCALENDAR

VERSION:2.0

PRODID:Josh Poley Blog Code

 

BEGIN:VEVENT

SUMMARY:Hello World

DTSTART;TZID=US-Pacific:20071210T090000

DTEND;TZID=US-Pacific:20071210T091500

END:VEVENT

 

END:VCALENDAR

 

iCalendar files are organized with a series of nested blocks which are denoted with the "BEGIN" and "END" tags. The block name (or what the block describes) is denoted by a keyword which will always start with the letter "V". All ICS files must contain a "VCALENDAR" block which is the main container.

 

VERSION:2.0

PRODID:Josh Poley Blog Code

Inside the VCALENDAR block, there must be a "VERSION" tag; we use 2.0 here as that references RFC 2445. Each VCALENDAR block must also include a "PRODID" tag, which is a string describing the generator of the iCalendar content.

 

A VEVENT block will describe an actual item on your calendar. The SUMMARY tag defines the subject of the entry and the DTSTART and DTEND tags specify when the event happens.

DTSTART;TZID=US-Pacific:20071210T090000

The date/time stamps are organized as such: An optional time zone string (which is denoted with the "TZID" string), followed by the date: YYYYMMDD. The letter "T" is used to separate the time which is in the form: HHMMSS. In this sample, we specify Pacific Time, and our calendar item starts at 9:00AM on December 10th, 2007.

Reminders

Now, if we want to add a reminder, we will stick a VALARM block inside the VEVENT section:

BEGIN:VALARM

TRIGGER:-PT15M

ACTION:DISPLAY

END:VALARM

 

The "TRIGGER" tag defines when the reminder will go off, in our case we tell the calendar system to remind the user 15 minutes before the event. The "ACTION" tag denotes how the software should notify the user; here we tell the application to display a visual reminder.

Conclusion

Many testing automation tools make use of email to help coordinate the distribution of information. Adding calendar items into the mix may be appropriate for your organization and situation, and this post should give you enough to get started.

 

Disclaimer: The above samples work for me when using Outlook 2007. You may need to tweak them as necessary to get them working with your calendar software as various products implement the RFC with varying degrees of consistency.

 

Security Reminder: As with opening any attachments, use common sense and be sure you trust the source and the content before opening/executing files.

 

 

Edit 12/12/2007:

The next post shows how to setup IIS to serve up dynamic ICS files.