Outlook .ics (iCalendar) files

Results 1 to 2 of 2

Thread: Outlook .ics (iCalendar) files

  1. #1
    Join Date
    Dec 1969

    Default Outlook .ics (iCalendar) files

    Hi,<BR><BR>I just wondered if any of you here have ever used ASP to generate .ics iCalendar files for Outlook? I&#039;ve seen an example whereby a user enters a date into a form, and a .ics file is created.<BR><BR>The user then clicks on a link to this file which then opens a new calendar appointment in Outlook 2000. The user then presses Save and now has a new appointment in his/her calendar.<BR><BR>The .ics file seems to be fairly straightforward in terms of the information contained within, but I just wondered if anyone here has developed for this kind of thing before?<BR><BR>I&#039;m basically looking for any relevant articles/information which could help me replicate this with ASP. I&#039;ve been searching through Google and the MSDN site and so far, I&#039;ve only come up with an example showing what can achieved, but there is no mention of how it is actually accomplished.<BR><BR>I hope some of that actually makes sense lol.<BR><BR>Thanks in advance,<BR><BR>hellz.

  2. #2
    Join Date
    Dec 1969

    Default RE: Outlook .ics (iCalendar) files

    Here is a link to an article note you do not have to create a component that creates an *.vcd or *.ics file liek the article states but rather use the response.contentype="text/x-vCalendar" and regular response.writes with an asp page.<BR><BR>http://www.swynk.com/friends/lesandrini/vCal01.asp<BR><BR>helps with the format of the card though. I have an example some where taht I keep meaning to implement on my website. Anyways here is an example of some code to produce a vCard file ie outlook contact, use similar method to produce vCal file (better than ics I think as should be accepted by clendar clients other than outlook also). Change contentype and format of output to match vCard specs and you should be good to go. I did have some problems with creating an all day event as couldn&#039;t get the correct parm values in the vCard file. If you get it working drop me an e-mail with some code if you would frank@kfhome.com. Anyways here is my code for a vCard change as you like<BR><BR>&#060;%@ LANGUAGE=VBSCRIPT %&#062;<BR>&#060;%<BR>response.Expires = 0<BR>response.ExpiresAbsolute = Now() - 1<BR>response.addHeader "pragma","no-cache"<BR>response.addHeader "cache-control","private"<BR>Response.CacheControl = "no-cache" <BR> Dim intPageLevel <BR> intPageLevel = 1<BR>%&#062;<BR>&#060;!--#include virtual="/includes/chkUserLevel.asp"--&#062;<BR>&#060;!--#include virtual="/includes/dbConn.asp"--&#062;<BR><BR>&#060;%<BR><BR><BR>Response.Buffe r = True<BR>Response.ContentType = "text/x-vcard"<BR><BR>&#039;Variables for Database <BR>Dim rsData, strSQL, i<BR><BR>&#039;General Variables<BR>Dim strOut, intID, strType, strTmp1, strTmp2<BR> <BR> &#039;id of addressee<BR> If Len(Request.QueryString("ID")) &#060;&#062; 0 Then intID = Cint(Request.QueryString("ID"))<BR> If Len(Request.QueryString("Type")) &#060;&#062; 0 Then strType = Request.QueryString("Type")<BR><BR> &#039;Do Nothing if no input<BR> If Len(intID & "" ) = 0 Or Len(strType) = 0 Then Response.End<BR><BR> If Ucase(strType) = "FAMILY" Then<BR> strSQL = "SELECT UserInfoTbl.dbID as ID, userLevel, F_Name, L_Name, Address1, Address2, City, State, Zip, Country, PhoneHA, PhoneHB, PhoneHC, PhoneCA, PhoneCB, PhoneCC, [E-Mail] From UserInfoTbl INNER JOIN familyAddBook ON userInfoTbl.dbID=familyAddBook.dbID Where userInfoTbl.dbID=" & intID<BR> ElseIF Ucase(strType) = "PERSONAL" Then<BR> strSQL = "SELECT * From personalAddBook WHERE ID=" & intID & " And dbID=" & Session("dbID") <BR> End IF<BR><BR><BR> Set rsData = Server.CreateObject("ADODB.Recordset") <BR> rsData.Open strSQL, objConn, adOpenForwardOnly, adLockReadOnly, adCmdText<BR> <BR> &#039;Do Nothing if no data<BR> If rsData.EOF Then<BR> rsData.Close<BR> Set rsData = Nothing<BR> objConn.Close<BR> set objConn = Nothing <BR> Response.End<BR> End If<BR> <BR> If Len(rsData("PhoneHA"))&#060;&#062;0 Then strTmp1 = "(" & rsData("PhoneHA") & ")"<BR> If Len(rsData("PhoneHB")) &#060;&#062; 0 And Len(rsData("PhoneHC")) &#060;&#062; 0 Then strTmp1 = strTmp1 & " " & rsData("PhoneHB") & "-" & rsData("PhoneHC")<BR><BR> If Len(rsData("PhoneCA"))&#060;&#062;0 Then strTmp2 = "(" & rsData("PhoneCA") & ")"<BR> If Len(rsData("PhoneCB")) &#060;&#062; 0 And Len(rsData("PhoneCC")) &#060;&#062; 0 Then strTmp2 = strTmp2 & " " & rsData("PhoneCB") & "-" & rsData("PhoneCC")<BR> <BR>%&#062;<BR><BR>&#060;%<BR><BR>&#039;dteInDat e = CDate(Request.QueryString("BDay"))<BR>&#039;strFmt Date = Year(dteInDate) & "-" & Month(dteInDate) & "-" & Day(dteInDate)<BR><BR>strOut = "BEGIN:VCARD" & vbCrlf<BR>strOut = strOut & "FN:" & rsData("F_Name") & " " & rsData("L_Name") & vbCrlf<BR>strOut = strOut & "ADR;POSTAL;HOME:;;" _<BR> & rsData("Address1") & ";" _<BR> & rsData("Address2") & ";" _<BR> & rsData("City") & ";" _<BR> & rsData("State") & ";" _<BR> & rsData("Zip") & ";" & vbCrlf<BR> <BR>strOut = strOut & "TEL;Home;VOICE;MESG;PREF:" & strTmp1 & vbCrlf<BR>&#039;strOut = strOut & "TEL;Work;VOICE;MESG:" & Request.QueryString("WorkPhone") & vbCrlf<BR>strOut = strOut & "TEL;Cell;VOICE;MESG:" & strTmp2 & vbCrlf<BR>&#039;strOut = strOut & "BDAY:" & strFmtDate & vbCrlf<BR>strOut = strOut & "EMAIL;Internet:" & rsData("e-mail") & vbCrlf<BR>&#039;strOut = strOut & "WEB:" & Request.QueryString("webSite") & vbCrlf<BR>strOut = strOut & "REV:20010307T103411" & vbCrlf<BR>strOut = strOut & "VERSION:2.1" & vbCrlf<BR>strOut = strOut & "END:VCARD" & vbCrlf<BR><BR>rsData.Close<BR>Set rsData = Nothing<BR>objConn.Close<BR>set objConn = Nothing<BR><BR>Response.Addheader "Content-Disposition", "inline; filename=general.vcf"<BR>Response.CacheControl = "public" <BR><BR>Response.Write(strOut)<BR>Response.End<BR> <BR><BR><BR>%&#062;<BR><BR>also if you want to see how it works signup at http://www.kfhome.com and create a contact in your addressbook. View the addressbook and click on persons name for more info. Will see a button to add to Outlook which calls the file above with correct parms.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts