This is a migrated thread and some comments may be shown as answers.

Appointment creation with a timezone offset

2 Answers 120 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Chitra
Top achievements
Rank 1
Chitra asked on 09 Feb 2011, 08:17 PM
I am using the rad scheduler with a exchange service provider, i have time zone offset value set for the scheduler and the display of appointments work fine. However when i create appointment with the offset i am getting an error:
The request failed schema validation: The 'http://schemas.microsoft.com/exchange/services/2006/types:BaseOffset' element is invalid - The value '-PT-8H' is invalid according to its datatype 'http://www.w3.org/2001/XMLSchema:duration' - The string '-PT-8H' is not a valid Duration value.

Looking through the documentation i found that the appointment time needs to be convered to UTC. So i added the following line in the appointment Inset event.

e.Appointment.Start.ToUniversalTime();
e.Appointment.End.ToUniversalTime();

While stepping thru the code the start and end times look ok, meaning they are in UTC however i get the error above
at Exchange\ExchangeSchedulerProvider.cs:line 166
       at Telerik.Web.UI.SchedulerProviderBase.Insert(ISchedulerInfo schedulerInfo, Appointment appointmentToInsert)
when trying to create the item.

Can you please help?

2 Answers, 1 is accepted

Sort by
0
Nikolay Tsenkov
Telerik team
answered on 15 Feb 2011, 10:21 AM
Hi Chitra,

Could you, please, try to assign the values, not only to call the method ToUniversalTime(), e.g. like the following:
e.Appointment.Start = e.Appointment.Start.ToUniversalTime();
e.Appointment.End = e.Appointment.End.ToUniversalTime();


Regards,
Nikolay Tsenkov
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Gabe Silvarajoo
Top achievements
Rank 2
answered on 19 Oct 2012, 08:13 PM
I was experiencing this problem as well. The problem occurs when there's a negative offset in the time zone. The proper format should be -PT8H and not -PT-8H. What I did to fix this was to modify the ExchangeSchedulerProvider.cs (line 337) by putting Math.Abs() to the tzOffset.TotalHours value.See code:

tz.BaseOffset = String.Format("{0}PT{1}H", sign, (int)Math.Abs(tzOffset.TotalHours));

Hope this helps.

Tags
Scheduler
Asked by
Chitra
Top achievements
Rank 1
Answers by
Nikolay Tsenkov
Telerik team
Gabe Silvarajoo
Top achievements
Rank 2
Share this question
or