New to Telerik UI for ASP.NET AJAX? Start a free 30-day trial
How to preserve the time of the appointments when exporting to iCalendar
HOW-TO
How to preserve the time of the appointments when exporting to iCalendar regardless of the system's
CurrentTimeZone and RadScheduler's TimeZoneOffset value.
SOLUTION
Refer to the iCalendar Export online example and modify the code for the AppointementCommand event as follows:
C#
protected void RadScheduler1_AppointmentCommand(object sender, AppointmentCommandEventArgs e)
{
if (e.CommandName == "Export")
{
DateTime aptStart = DateTime.SpecifyKind(e.Container.Appointment.Start, DateTimeKind.Local);
TimeSpan aptStartOffset = TimeZone.CurrentTimeZone.GetUtcOffset(aptStart) - RadScheduler1.TimeZoneOffset;
string iCal = RadScheduler.ExportToICalendar(e.Container.Appointment, aptStartOffset);
WriteCalendar(iCal);
}
}