Appointment creation with a timezone offset

3 posts, 0 answers
  1. Chitra
    Chitra avatar
    1 posts
    Member since:
    Feb 2011

    Posted 09 Feb 2011 Link to this post

    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 '' element is invalid - The value '-PT-8H' is invalid according to its datatype '' - 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.


    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. Nikolay Tsenkov
    Nikolay Tsenkov avatar
    734 posts

    Posted 15 Feb 2011 Link to this post

    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();

    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.
  3. Gabe Silvarajoo
    Gabe Silvarajoo avatar
    13 posts
    Member since:
    Apr 2009

    Posted 19 Oct 2012 Link to this post

    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.

Back to Top