Outlook Appointments, ASP and vCalendar

DataFast Consulting
Dean Evans and Associates Danny Lesandrini explains vCalendar

What is vCalendar

I recently posted some VB Script code that exploits the MS Outlook object model to create an Outlook Appointment Item in a Public Folder. I received several replies from programmers who downloaded the code, but had trouble getting it to work in an ASP page. It seems that it's not possible to set an object to the MAPI Namespace from VB Script in an ASP page. The following code returned the error, "Server unable to create object" ...

    Set objOutlook = CreateObject("Outlook.Application")
    Set objNamespace = objOutlook.GetNameSpace("MAPI")

Since we couldn't get around this seeming limitation of Outlook on IIS, I decided to pursue a different solution-- vCalendar.

vCalendar defines a transport and platform-independent format for exchanging calendaring and scheduling information in an easy, automated, and consistent manner. It captures information about event and "to-do" items that are normally used by applications such as a personal information managers (PIMs) and group schedulers. Programs that use vCalendar can exchange important data about events so that you can schedule meetings with anyone who has a vCalendar-aware program.

Beginning in December, 1996, the Internet Mail Consortium took on responsibility for the development and promotion of this important technology.

A vCalendar record is just a text file. If you do not have an automated facility to process vCalendar records, you can open them with a text editor and use the information. The content of a vCalendar file will vary with the information inserted by the file creator. The format we will use from our custom VB DLL looks like the following in a text editor:

    DESCRIPTION;ENCODING=QUOTED-PRINTABLE:Discuss Batmobile Maintenance ...

The above format omits some information specific to MS Outlook. This was done to make the file more compatible with non-Microsoft PIMs, which may be accessing the our vCalendar-enabled web page. To create a vCalendar file in MS Outlook format, follow these steps:
    1) In a Calendar folder, click to select an appointment for which you want a 
        vCalendar file.
    2) On the File menu, click Save As.
    3) In the "Save file as type" list, click to select vCalendar Format (*.vcs).
    4) In the Save In list, select the folder where you want to save the vCalendar 
         file, and then click Save.

NOTE: the DTSTART and DTEND entries above are a combination of the date and time in the format, YYYYMMDDThhmmssZ, where YYYY=year, MM=month, DD=day of the month, T=start time character, hh=hour, mm=minutes, ss=seconds, Z=end character. This string expresses the time as Greenwich Mean Time (GMT), on a 24-hour clock so must be adjusted to your time zone.

For example, if you are in the Mountain Time zone as I am, your time is 7 hours behind GMT. So, you would subtract 7 hours from the start and end times in the vCalender text to derive the correct time range for the appointment. In the appointment above the start time would be 153000-070000. Notice that a 24-hour clock is used and times are converted from A.M/P.M to military time.

Well, that's it for vCalendar. Now we'll look at how we can create a custom VB Class to handle the string parsing and vCalendar file creation. Then, the whole thing can come together in an ASP page which invokes the method to create the vCal file and the executes the VB Script necessary to insert our appointment in the Web User's Outlook Calendar.

This article was originally published on May 29, 2001
Page 1 of 3

Thanks for your registration, follow us on our social networks to keep up-to-date