UnknownError (503) when calling Graph API's /calendar/events for some users

Copper Contributor

Hi, when using the /calendar/events API, it returns "Unknown Error" for some users, but works OK for others. It reproduces consistently for at least 2 months.

 

Example request:


GET https://graph.microsoft.com/v1.0/users/07f20085-cd3e-4532-a59e-b454de5b62ea/calendar/events?$select=...
Authorization: Bearer %token%

And we get the following response (the message is abbreviated for brevity):

 

"error": {
  "code": "UnknownError",
  "message": "<html>\r\n<head>\r\n\t<meta charset=\"utf-8\">\r\n\t<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" />\r\n\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, user-scalable=yes\" />\r\n\t<title>Service Unavailable</title> <..>",
  "innerError": {
    "date": "2022-01-10T20:24:26",
    "request-id": "ce045d30-8f55-43ee-bddf-25d11f0766a6",
    "client-request-id": "ce045d30-8f55-43ee-bddf-25d11f0766a6"
  }
}

 

 

The error message is unfortunately unhelpful: there're no details as to what is wrong.

What we did:
1) Made sure the user has a cloud solution (i.e. not on-premises)
2) Asked the organization's admin to check if there's any difference between users for which the API works and for which the API doesn't; apparently, nothing suspect found

 

What can be the cause of this "UnknownError" response? Is this a bug on the Teams side, or is it a misconfiguration in the affected organization? Maybe there's some permissions that we're missing (even though it works OK for other orgs)? We're out of ideas.

7 Replies
@kgeyst- We are looking into this I will get back to you soon.

@kgeyst - We are tried to repro the scenario, but unable to repro. Could you please check it once permissions?
Get event - Microsoft Graph v1.0 | Microsoft Docs

Graph1.png

 

Thanks, 

Sayali

------------------------------------------------------------------------------------------------

If the response is helpful, please click "**Mark as Best Response**" and like it. You can share your feedback via Microsoft Teams Developer Feedback link. Click here to escalate.

@kgeyst - Could you please confirm if your issue has resolved or still looking for any help?

@Sayali-MSFT 

 

I decoded the generated JWT access token and it has the following roles:

  "roles": [
    "OnlineMeetings.ReadWrite.All",
    "CallRecords.Read.All",
    "User.Read.All",
    "Calendars.ReadWrite"
  ],

 

The same token works fine for another user. 

 

@kgeyst -As per document, you need to add the both permission.
Calendars.Read, Calendars.ReadWrite.

permission.png

Could you please add it and check it once?

Let us know if you have any query.

Ref. Doc:-List events - Microsoft Graph v1.0 | Microsoft Docs

As per https://docs.microsoft.com/en-us/graph/permissions-reference, "Calendars.ReadWrite" gives full access to calendars (including reading), while "Calendars.Read" is a subset of it if you only wish to read events.

 

Interestingly, while reading that page, I found this:

"Important Administrators can configure application access policy to limit app access to specific mailboxes and not to all the mailboxes in the organization, even if the app has been granted the application permissions of Calendars.Read or Calendars.ReadWrite"

@kgeyst- I cannot repro this with different Microsoft Accounts. We will check it internally whether it is a bug & let you know.