locked
Change TimeZone of existing appointment? RRS feed

  • Question

  • We have a bunch of appointments that have a timezone of GMT instead of our local time zone (Eastern Standard Time.)

     

    I'm trying to write an update using Exchange Web Services to modify only the timezone of an existing calendar item, but I can't seem to get it to work.

     

    Here is the code:

     

    Code Snippet

    UpdateItemType update = new UpdateItemType();

     

    update.ConflictResolution = ConflictResolutionType.AlwaysOverwrite;

    update.MessageDisposition = MessageDispositionType.SaveOnly;

     

    update.MessageDispositionSpecified = true;

    update.SendMeetingInvitationsOrCancellations = CalendarItemUpdateOperationType.SendToNone;

     

    update.SendMeetingInvitationsOrCancellationsSpecified = true;

    SetItemFieldType tzSet = new SetItemFieldType();

     

    tzSet.Item = new PathToUnindexedFieldType();

    ((PathToUnindexedFieldType)tzSet.Item).FieldURI = UnindexedFieldURIType.calendarMeetingTimeZone;

     

    CalendarItemType calitemupdate = new CalendarItemType();

    TimeZoneType est = new TimeZoneType();

    est.BaseOffset = "P0DT5H0M0.0S";

    est.TimeZoneName = "(GMT-05:00) Eastern Time (US & Canada)";

    calitem.MeetingTimeZone = est;

    tzSet.Item1 = calitemupdate;

     

    ItemChangeType itemChange = new ItemChangeType();

    itemChange.Item = calitem.ItemId;

    itemChange.Updates = new ItemChangeDescriptionType[] { tzSet };

    update.ItemChanges = new ItemChangeType[] { itemChange };

    UpdateItemResponseType response = esb.UpdateItem(update);

     

     

    Does anyone know why it might not be working?
    Tuesday, September 16, 2008 1:33 PM

All replies

  • Nevermind I found the problem, it was a coding error on my part.  I was assigning the new timezone to the original calendar item object, not the new one

    Tuesday, September 16, 2008 2:01 PM