we have created a vcs file using the following code.
Dim mstream As New MemoryStream
Dim writer As New StreamWriter(mstream)
writer.AutoFlush = True
GetvCalendarText(writer)
Response.Clear()
Response.AppendHeader("Content-Disposition", "attachment; filename=Event" & eventID & ".vcs")
Response.AppendHeader("Content-Length", mstream.Length.ToString)
Response.ContentType = "application/download"
Response.BinaryWrite(mstream.ToArray)
Response.End()
-
GetCalendarText method
Dim body As String = <b>New event</b> writer.WriteLine("BEGIN:VCALENDAR{0}", vbCrLf) writer.WriteLine("VERSION:1.0{0}", vbCrLf) writer.WriteLine("BEGIN:VEVENT{0}", vbCrLf) writer.WriteLine("DTStart:{0}{1}", DateTime.Now.ToString("yyyyMMddTHHmm00Z"), vbCrLf) writer.WriteLine("DTEnd:{0}{1}", DateTime.Now.AddHours(2).ToString("yyyyMMddTHHmm00Z"), vbCrLf) writer.WriteLine("DESCRIPTION:{0}", body) writer.WriteLine("X-ALT-DESC;FMTTYPE=text/html:{0}", body) writer.WriteLine("SUMMARY;ENCODING=QUOTED-PRINTABLE:{0}{1}", Test event, vbCrLf) writer.WriteLine("PRIORITY:3{0}", vbCrLf) writer.WriteLine("END:VEVENT{0}", vbCrLf) writer.WriteLine("END:VCALENDAR{0}", vbCrLf)
It is generating the vcs file and upon opening the file it is opening in Outlook 2010 with subject , start time and end time with correct values.
The description we have given is in html format but it is shown as plain text.
So how we can show the html description as such.
I tried to add html description in vCalendar format and can’t find any proper method to do this.
Finally changed our vCalendar format to iCalendar and it allows to show html description.
We removed the description line ie
writer.WriteLine("DESCRIPTION:{0}", body)and now it showing html formatted description.
Following parts also changed.
and