Jan 10 2022 01:11 PM
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.
Jan 10 2022 11:53 PM
Jan 11 2022 03:41 AM - edited Jan 11 2022 03:42 AM
@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
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.
Jan 12 2022 02:50 AM
Jan 12 2022 03:25 AM
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.
Jan 12 2022 03:44 AM - edited Jan 12 2022 03:46 AM
@kgeyst -As per document, you need to add the both permission.
Calendars.Read, Calendars.ReadWrite.
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
Jan 12 2022 05:21 AM - edited Jan 12 2022 05:24 AM
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"
Jan 12 2022 10:21 PM