I'm trying to create a vCalendar appointment to send to our clients. The date and time is of a clinic appointment. The server that generates the vCal is on Eastern time but we have clients that span the whole country. The time and date is time zone independent because it's set by the clinic they are seeing. I need to send the vCal using the specific date and time and not the date and time adjusted for the time zone. Here is the code i'm using now but no matter what i do it adjusts for time zone on the client end which results in an incorrect time for their appointment.
Private Function CreateCalendarItem(ByVal Mail As System.Net.Mail.MailMessage, ByVal PlainText As String, ByVal ApptDateTime As String) As System.Net.Mail.AlternateView
Dim ApptDate As DateTime = CDate(ApptDateTime)
Dim calendarEventText As StringBuilder = New StringBuilder
calendarEventText.AppendLine("BEGIN:VCALENDAR")
calendarEventText.AppendLine("METHOD:REQUEST")
calendarEventText.AppendLine("PRODID:-//MyCompanyName")
calendarEventText.AppendLine("VERSION:2.0")
calendarEventText.AppendLine("BEGIN:VEVENT")
calendarEventText.AppendLine("DTSTART:" & ApptDate.ToUniversalTime.ToString("yyyyMMddTHHmmss"))
calendarEventText.AppendLine("DTSTAMP:" & ApptDate.ToUniversalTime.ToString("yyyyMMddTHHmmss"))
calendarEventText.AppendLine("DTEND:" & ApptDate.ToUniversalTime.ToString("yyyyMMddTHHmmss"))
calendarEventText.AppendLine("UID:" & Guid.NewGuid().ToString)
calendarEventText.AppendLine("DESCRIPTION:" & PlainText)
calendarEventText.AppendLine("X-ALT-DESC;FMTTYPE=text/html:" & PlainText)
calendarEventText.AppendLine("SUMMARY:" & Mail.Subject)
calendarEventText.AppendLine("ORGANIZER:MAILTO:" & Mail.From.Address)
If Mail.To.Count > 0 Then
calendarEventText.AppendLine("ATTENDEE;CN=\" & Mail.To(0).DisplayName & "\;RSVP=FALSE:mailto:" & Mail.To(0).Address)
Else
calendarEventText.AppendLine("ATTENDEE;CN=\\;RSVP=FALSE:mailto" & "")
End If
calendarEventText.AppendLine("BEGIN:VALARM")
calendarEventText.AppendLine("TRIGGER:-PT15M")
calendarEventText.AppendLine("ACTION:DISPLAY")
calendarEventText.AppendLine("DESCRIPTION:Reminder")
calendarEventText.AppendLine("END:VALARM")
calendarEventText.AppendLine("END:VEVENT")
calendarEventText.AppendLine("END:VCALENDAR")
Dim ct As System.Net.Mime.ContentType = New System.Net.Mime.ContentType("text/calendar")
ct.Parameters.Add("method", "REQUEST")
Dim avCal As System.Net.Mail.AlternateView = System.Net.Mail.AlternateView.CreateAlternateViewFromString(calendarEventText.ToString(), ct)
Return avCal
End Function
Any help would GREATLY be appreciated. Thank you for your input.