2
votes

I am currently using Office Graph API to handle meetings of users Calenders. I have subscribe to receive notifications if a event is create, updated and deleted using the "/subscriptions" request! My users are using the Lisbon time zone (in summer = UTC+1, winter = UTC)

When an event is created in office 365 by a user, on the side of my application, if the event is a recursive meeting with no end date I update (via the Graph API) the meeting so that it has an end date. [Note: One of the rules of my application is that no meeting has more than 365 days.]

Problem : The series is shrunk to the end date that I updated via API but the time is left with the wrong timezone. I have already tried to request the API without timezone and I have already requested update with timezone UTC and timezone UTC +1 and I always have the same problem. On the office side, after my update, the meeting time is one hour less.

The following image is a exemple of series, that has a no end range:

enter image description here

I fetch some child meetings before update and it is correct. In portugal the time change day is 2019-03-30, so day 30 start in 10h00 UTC and day 31 09:00 UTC:

enter image description here

Here I send the request to office 365 to update end of recurrence (end date):

enter image description here

After send the update request, I fetch the same children and 2019-03-30 and day 2019-03-31 have both start as 10h00. After this update in client calendar the meetings have wrong start and end hour:

enter image description here

I have already tried putting in the field of Graph API recurrenctTImeZone: UTC, GMT Standard Time and simply do not put anything and I always have the same return. I can not solve this problem.

Do you have any idea what might be wrong?

3
Are you sending any other values in your PATCH request (besides recurrence)?Jason Johnston
Jason, no, I just send what is in the above image representing the request of my end of recurrence update.D. Pinheiro

3 Answers

3
votes

After several attempts at resolution, I was able to talk to the Office 365 Dev team and was surprised by the negative feedback.

They indicated that in fact there is an unknown bug in the Microsoft API Graph in this specific situation and that they do not guarantee the resolution of this bug!

Their suggestion is that we use the Outlook Calendar API Rest API only for this situation. In conclusion, because of this unknown error already assumed by Microsoft I will have to have 2 different APIs implemented in my platform: Microsoft Graph API that is currently recommended by Microsoft, and the Outlook Calendar Rest API because of this bug.

Outlook Calendar API Rest Solution:

  1. Create a repeated event with no end date

enter image description here

  1. Retrieve the calendar view

enter image description here

  1. Get the Recurrence of the event

enter image description here

  1. Update the event

enter image description here

  1. Retrieve the calendar view after update

enter image description here

0
votes

You can actually use this in the header of the requests

Prefer: outlook.timezone="Central Standard Time"

That way it knows what time zone you want to operate in with your calculations. Further documentation on this is available here https://docs.microsoft.com/en-us/graph/api/user-list-events?view=graph-rest-1.0#support-various-time-zones

0
votes

I do not reproduce this behavior with a user in the Pacific Standard Time time zone OR the GMT Standard Time time zone. For clarity, I'm doing all tests with Postman, and I did not use the Prefer: outlook.timezone header Jeremy pointed out above.

I created a daily, no end appointment for the user at 2PM Pacific, which is 22:00 UTC. Also note that DST starts in this time zone on March 10. As you can see below, the times are correct on the instances both before and after the update.

I also repeated this same sequence of events for a user in the GMT Standard Time time zone (configured like so in Outlook on the web):

OOW config

I got the exact same results for this user.

I would suggest that when you patch the recurrence you always use the recurrenceTimeZone from the original recurrence. You may have corrupted the recurrence by patching with UTC originally.

Get event after create in Outlook on the web

GET /me/events/{id}&$select=originalStartTimeZone,originalEndTimeZone,start,end,recurrence
{
  "id": "AAMkAGE1NWM...",
  "originalStartTimeZone": "Pacific Standard Time",
  "originalEndTimeZone": "Pacific Standard Time",
  "start": {
    "dateTime": "2019-01-24T22:00:00.0000000",
    "timeZone": "UTC"
  },
  "end": {
    "dateTime": "2019-01-24T22:30:00.0000000",
    "timeZone": "UTC"
  },
  "recurrence": {
    "pattern": {
      "type": "daily",
      "interval": 1,
      "month": 0,
      "dayOfMonth": 0,
      "firstDayOfWeek": "sunday",
      "index": "first"
    },
    "range": {
      "type": "noEnd",
      "startDate": "2019-01-24",
      "endDate": "0001-01-01",
      "recurrenceTimeZone": "Pacific Standard Time",
      "numberOfOccurrences": 0
    }
  }
}

Get instances before modifying

Notice the shift in start/end times.

GET /me/events/{id}/instances?startDateTime=2019-03-09T00:00:00&endDateTime=2019-03-11T00:00:00&
$select=originalStartTimeZone,originalEndTimeZone,start,end
{
  "value": [
    {
      "id": "AAMkAGE1NWM...",
      "originalStartTimeZone": "Pacific Standard Time",
      "originalEndTimeZone": "Pacific Standard Time",
      "start": {
        "dateTime": "2019-03-09T22:00:00.0000000",
        "timeZone": "UTC"
      },
      "end": {
        "dateTime": "2019-03-09T22:30:00.0000000",
        "timeZone": "UTC"
      }
    },
    {
      "@odata.etag": "W/\"bReRxUIs3kGIyXXcVJg69AAANf7nZQ==\"",
      "id": "AAMkAGE1NWM...",
      "originalStartTimeZone": "Pacific Standard Time",
      "originalEndTimeZone": "Pacific Standard Time",
      "start": {
        "dateTime": "2019-03-10T21:00:00.0000000",
        "timeZone": "UTC"
      },
      "end": {
        "dateTime": "2019-03-10T21:30:00.0000000",
        "timeZone": "UTC"
      }
    }
  ]
}

Update event recurrence to add end date

Notice that I left recurrenceTimeZone as the same value as the original.

PATCH /me/events/{id}

{
  "recurrence": {
    "pattern": {
      "type": "daily",
      "interval": 1,
      "month": 0,
      "dayOfMonth": 0,
      "firstDayOfWeek": "sunday",
      "index": "first"
    },
    "range": {
      "type": "endDate",
      "startDate": "2019-01-24",
      "endDate": "2020-01-23",
      "recurrenceTimeZone": "Pacific Standard Time",
      "numberOfOccurrences": 0
    }
  }
}

Get instances after modification

Notice that the start/end times are still shifted correctly.

GET /me/events/{id}/instances?startDateTime=2019-03-09T00:00:00&endDateTime=2019-03-11T00:00:00&
$select=originalStartTimeZone,originalEndTimeZone,start,end
{
  "value": [
    {
      "id": "AAMkAGE1NWM...",
      "originalStartTimeZone": "Pacific Standard Time",
      "originalEndTimeZone": "Pacific Standard Time",
      "start": {
        "dateTime": "2019-03-09T22:00:00.0000000",
        "timeZone": "UTC"
      },
      "end": {
        "dateTime": "2019-03-09T22:30:00.0000000",
        "timeZone": "UTC"
      }
    },
    {
      "@odata.etag": "W/\"bReRxUIs3kGIyXXcVJg69AAANf7nZQ==\"",
      "id": "AAMkAGE1NWM...",
      "originalStartTimeZone": "Pacific Standard Time",
      "originalEndTimeZone": "Pacific Standard Time",
      "start": {
        "dateTime": "2019-03-10T21:00:00.0000000",
        "timeZone": "UTC"
      },
      "end": {
        "dateTime": "2019-03-10T21:30:00.0000000",
        "timeZone": "UTC"
      }
    }
  ]
}