none
[EWS JAVA API 1.1] Incorrect time from appointment object RRS feed

  • Question

  • When I add appointment for specific user on Exchnage Server, I do this through Outlook web app. Next I try to find appointments for specific user and time interval (CalendarView)

    FindItemsResults<Appointment> appointments = exchange.findAppointments(WellKnownFolderName

    Calendar,calendarView);

    exchange is ExchangeService object

    Unfortunatly I always get Appointment.getStart.getTime 2 hours behind, compared to the time that I defined on appointment in outlook web app

    example. getTime - 13:00h, Outlook web app - 15:00h

    Tuesday, October 16, 2012 2:25 PM

All replies

  • Please consider timezone difference here. e.g. The timezone owa shows is per configured timezone in owa options and the 13:00 h you are passing is treated as UTC. Please check timezones considered in request and owa.

    Thanks, Nimesh

    Tuesday, October 16, 2012 5:55 PM
  • I checked programaticly timeZone (appointment.getTimeZone) of appointment and it is the same as in outlook web app options (Regional Settings for user).

    Both are set to GMT +1

    I must add that i'm using impersonation for this user.

    Exchange Server 2010

    EDIT. When I excplicity set appointment.setStartTimeZone and appointment.setEndTimeZone to America/Antigua TimeZoneDefinition (just for test) and same under ExchangeService constructor. When I appointment.getTimeZone again it is GMT +1. Why is that? as my expicit setting are ignored?

    EDIT. I figured that TimeZone for appointment is defined in outlook web app at the time of creation. I can't retrive appointment object and change timeZone for that appointment. So now, appointmetnt is in correct Timezone (+1GMT), why than Appointment.getStart returns time 2 hours behind compared to time which I see in outlook web app




    • Edited by mata4 Wednesday, October 17, 2012 10:58 AM
    Wednesday, October 17, 2012 7:11 AM
  • I can't see from the above whether or not you are specifying a time zone when you create the ExchangeService. E.g.

    ExchangeService service = new ExchangeService(TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time"));

    This might help:

    http://msdn.microsoft.com/en-us/library/exchange/dd633689(v=exchg.80).aspx

    Mobile OWA For Smartphone
    www.leederbyshire.com
    email a@t leederbyshire d.0.t c.0.m

    Thursday, October 18, 2012 3:02 PM
  • ExchangeService exchange = new ExchangeService(
    				ExchangeVersion.Exchange2010,
    				TimeZone.getTimeZone("Europe/Zagreb));

    above code is for my service
    Friday, October 19, 2012 8:18 AM
  • I think that if the appointment has a timezone configured, then it will override the timezone you specified for the service object (but you would need to test that).  But I think that what you are getting back from EWS is going to be the time in UTC.  I've never know any Exchange API since CDO to do any time conversion for you.  I think that what it is giving you are two things:

    The Start Time in UTC, and

    The Time Zone for the appointment

    and it is up to you to do the conversion.  At least, that is how it has always seemed to me.  If I create an appointment here, and change the time zone and update it several times, it still always returns the time in UTC when I ask for the start time.  Of course, the time appears shifted when you look at it in Outlook and OWA, because it would be unhelpful not to do so.


    Mobile OWA For Smartphone
    www.leederbyshire.com
    email a@t leederbyshire d.0.t c.0.m

    Friday, October 19, 2012 1:59 PM