none
Wrong time in invite message body RRS feed

  • Question

  • Hello. I have a code on C# for creating an appointment through Exchange API. It's working good and create appointment with time converted from local timezone to the UTC. But in result the organizer of appointment get a message like on screenshot.

    Below it must be 8:00-9:00 but it is 5:00-6:00.

    How to fix it? The invite message was generated by exchange automatically and it's not controlled by code.

    I can show the code that I use to create an appointment.

    Exchange Version: 2010 SP1

    Code for connecting to Exchange:

    _exchangeService = new ExchangeService(ExchangeVersion.Exchange2010_SP1)
                                {
                                    TraceEnabled = true,
                                    TraceFlags = TraceFlags.All,
                                    Credentials = new WebCredentials(Login, Password, Domain)
                                };

    Code for creating an appointment:

    Appointment meeting = new Appointment(ExchangeService);
    meeting.Subject = title;
    meeting.Body = descriptions;
    meeting.StartTimeZone = TimeZoneInfo.Utc;
    meeting.EndTimeZone = TimeZoneInfo.Utc;
    DateTime dateStartUts = TimeZoneInfo.ConvertTimeToUtc(dateStart, TimeZoneInfo.Local);
    meeting.Start = dateStartUts;
    DateTime dateEndUts = TimeZoneInfo.ConvertTimeToUtc(dateEnd, TimeZoneInfo.Local);
    meeting.End = dateEndUts;

    Invite message:


    • Edited by DafeUot Sunday, February 26, 2017 6:55 AM added code and Exchange version
    Sunday, February 26, 2017 6:23 AM

All replies

  • meeting.StartTimeZone = TimeZoneInfo.Utc;
    meeting.EndTimeZone = TimeZoneInfo.Utc;

    The start and End Timezone for the meeting should be the timezone your creating the meeting in unless you want the Meeting to be in the UTC timezone

    Given the Timezone your providing the down-level text your seeing is appropriate for a UTC meeting

    The only other place you can set the TimeZone is in the ExchangeServce declaration https://msdn.microsoft.com/en-us/library/office/dd633707(v=exchg.80).aspx

    Sunday, February 26, 2017 11:52 PM
  • Tried this code:

    meeting.StartTimeZone = TimeZoneInfo.Local;
    meeting.EndTimeZone = TimeZoneInfo.Local;
    meeting.Start = dateStart;
    meeting.End = dateEnd;

    Got this error:

     Unable to convert 2014-01-01T00:00:00.000 from (UTC+03:00) Москва, Санкт-Петербург, Волгоград to UTC. 
    There is convert method somewhere inside Exchange's call stack.

    Monday, February 27, 2017 1:46 PM
  • That looks like the know issue with the timezone your using see https://github.com/OfficeDev/ews-managed-api/issues/13 for more details.

    Cheers
    Glen

    Tuesday, February 28, 2017 3:24 AM