I am able to generate a calendar successfully however, if someone from a different timezone accepts it does not adjust to their timezone. Does anyone know how I can compensate for this in the following code?
Unfortunately this issue is still unresolved. This is the code i have now. A clause for each Timezone however they are off by 1 hour. Not sure what i am missing.
developerlil...
Member
33 Points
52 Posts
Generating Outlook Calendar with timezone difference
Feb 28, 2011 01:26 PM|LINK
Hi:
I am able to generate a calendar successfully however, if someone from a different timezone accepts it does not adjust to their timezone. Does anyone know how I can compensate for this in the following code?
TrainingStart = Convert.ToDateTime(ReturnValue4); TrainingEnd = TrainingStart.AddMinutes(30); //Initialization MemoryStream mStream = new MemoryStream(); StreamWriter sw = new StreamWriter(mStream); sw.AutoFlush = true; //Header sw.WriteLine("BEGIN:VCALENDAR"); sw.WriteLine("VERSION:2.0"); sw.WriteLine("PRODID:-//Flo Inc.//FloSoft//EN"); sw.WriteLine("BEGIN:VEVENT"); //Body sw.WriteLine("DTSTART:" + TrainingStart.ToString("s")); sw.WriteLine("DTEND:" + TrainingEnd.ToString("s")); sw.WriteLine("LOCATION:" + Location); sw.WriteLine("X-ALT-DESC;FMTTYPE=text/html:" + Description.Replace("\n", " ")); sw.WriteLine("SUMMARY:" + Subject); //Footer sw.WriteLine("PRIORITY:" + Priority); sw.WriteLine("END:VEVENT"); sw.WriteLine("END:VCALENDAR"); //Make it Downloadable Response.Clear(); Response.AppendHeader("Content-Disposition", "attachment; filename=Add2Calendar.ics"); Response.AppendHeader("Content-Length", mStream.Length.ToString()); Response.ContentType = "html/x-vCalendar"; //Response.ContentType = "application/download"; Response.BinaryWrite(mStream.ToArray()); Response.End(); sqlcon.Close();developerlil...
Member
33 Points
52 Posts
Re: Generating Outlook Calendar with timezone difference
Mar 17, 2011 06:14 PM|LINK
Unfortunately this issue is still unresolved. This is the code i have now. A clause for each Timezone however they are off by 1 hour. Not sure what i am missing.
if (trainingtimezone.Equals("(EST)")) { //Initialization MemoryStream mStream = new MemoryStream(); StreamWriter sw = new StreamWriter(mStream); sw.AutoFlush = true; //Header sw.WriteLine("BEGIN:VCALENDAR"); sw.WriteLine("VERSION:2.0"); sw.WriteLine("PRODID:-//Flo Inc.//FloSoft//EN"); sw.WriteLine("BEGIN:VEVENT"); //Body sw.WriteLine("DTSTART;TZID=US/Eastern:" + TrainingStart.ToString("s")); sw.WriteLine("UTC-OFFSET:-0500"); sw.WriteLine("DTEND;TZID=US/Eastern:" + TrainingEnd.ToString("s")); sw.WriteLine("LOCATION:" + Location); sw.WriteLine("X-ALT-DESC;FMTTYPE=text/html:" + Description.Replace("\n", " ")); sw.WriteLine("SUMMARY:" + Subject); //Footer sw.WriteLine("PRIORITY:" + Priority); sw.WriteLine("END:VEVENT"); sw.WriteLine("END:VCALENDAR"); //Make it Downloadable Response.Clear(); Response.AppendHeader("Content-Disposition", "attachment; filename=Add2Calendar.ics"); Response.AppendHeader("Content-Length", mStream.Length.ToString()); Response.ContentType = "html/x-vCalendar"; Response.BinaryWrite(mStream.ToArray()); Response.End(); }