Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VCS File description in html

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.

like image 755
Mahesh KP Avatar asked Aug 03 '26 04:08

Mahesh KP


1 Answers

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.

Response.AppendHeader("Content-Disposition", "attachment; filename=Event" & eventID & ".ics")

and

writer.WriteLine("VERSION:2.0{0}", vbCrLf)
like image 145
Mahesh KP Avatar answered Aug 04 '26 20:08

Mahesh KP