I have created the following CFC based on a UDF I found online somewhere. It basically creates a .ics (iCalendar) file that is e-mailed to a client. The event is accepted by iCal on the Mac but fails when someone with MS Outlook tries to open it. I even added a bunch of fields that I noticed in an icalendar event sent from Outlook but it still fails. I also added the contents of the generated ics file below...
Any suggestion?
===========The CFC======================
<cfcomponent>
<cffunction name="iCal" access="public" returntype="string">
<cfargument name="EventID" type="numeric" required="no" default="1">
<cfquery name="stEvent" datasource="#application.dsn#">
SELECT Title as subject,"Host", (City + '\, ' + State) as location, StartDate as StartTime, EndDate as EndTime, Description, contactemail, '1' as Priority
FROM dbo.tbl_calendar WHERE EventID = #Arguments.EventID#
</cfquery>
<cfset vCal = "">
<cfset CRLF = "#chr(13)#">
<cfscript>
if (NOT IsDefined("stEvent.StartTime"))
stEvent.StartTime = DateConvert('local2Utc', Now());
//if (NOT IsDefined("stEvent.EndTime"))
//stEvent.EndTime = DateConvert('local2Utc', Now());
if (NOT IsDefined("stEvent.location"))
stEvent.location = "N/A";
if (NOT IsDefined("stEvent.subject"))
stEvent.subject = "Auto vCalendar Generated";
if (NOT IsDefined("stEvent.description"))
stEvent.description = "Autobot VCalendar Generated";
if (NOT IsDefined("stEvent.priority"))
stEvent.priority = "1";
vCal = "BEGIN:VCALENDAR" & CRLF;
vCal = vCal & "PRODID:-//Microsoft Corporation//Outlook 10.0 MIMEDIR//EN" & CRLF;
vCal = vCal & "VERSION:2.0" & CRLF;
vCal = vCal & "METHOD:PUBLISH" & CRLF;
vCal = vCal & "BEGIN:VEVENT" & CRLF;
vCal = vCal & "ORGANIZER:MAILTO:support@siriusinnovations.com" & CRLF;
vCal = vCal & "DTSTART:" &
DateFormat(stEvent.StartTime,"yyyymmdd") & "T" &
TimeFormat(stEvent.StartTime, "HHmmss") & "Z" & CRLF;
vCal = vCal & "DTEND:" &
DateFormat(stEvent.StartTime,"yyyymmdd") & "T" &
TimeFormat(stEvent.StartTime, "HHmmss") & "Z" & CRLF;
vCal = vCal & "LOCATION:" & stEvent.location & CRLF;
vCal = vCal & "TRANSP:OPAQUE" & CRLF;
vCal = vCal & "SEQUENCE:0" & CRLF;
vCal = vCal & "DESCRIPTION:";
// Convert CF_CRLF (13_10) into =0D=0A with CR/LF and indent sequences
description = REReplace(stEvent.description,"[#Chr(13)##Chr(10)#]", "=0D=0A=#Chr(13)##Chr(10)# ", "ALL");
vCal = vCal & description & CRLF;
vCal = vCal & "SUMMARY:" & stEvent.subject & CRLF;
vCal = vCal & "PRIORITY:" & stEvent.priority & CRLF;
vCal = vCal & "CLASS:PUBLIC" & CRLF;
vCal = vCal & "END:VEVENT" & CRLF;
vCal = vCal & "END:VCALENDAR";
</cfscript>
<cffile action="write" file="D:\Websites\test\sandbox\vcaltest.ics" output="#vcal#">
<cfmail to="phayes@xxxs.com" from="phayes@xxx.com" subject="Vcal Test">
<cfmailparam file="D:\Websites\test\sandbox\vcaltest.ics">
</cfmail>
<cfset Status = "Success!">
<cfreturn status>
</cffunction>
==================================
=========The contents of the ICS file=========
BEGIN:VCALENDAR
PRODID:-//Microsoft Corporation//Outlook 10.0 MIMEDIR//EN
VERSION:2.0
METHOD:PUBLISH
BEGIN:VEVENT
ORGANIZER:MAILTO:support@siriusinnovations.com
DTSTART:20050916T000000Z
DTEND:20050916T000000Z
LOCATION:Norwalk\, CT
TRANSP:OPAQUE
SEQUENCE:0
DESCRIPTION:The MAC meeting is scheduled for Wednesday, June 16, 2004 1 p.m. at Norwalk Hospital Emergency Department Conference Room.
SUMMARY:Medical Advisory Committee (MAC) Meeting
PRIORITY:1
CLASS:PUBLIC
END:VEVENT
END:VCALENDAR
=======================