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

%3CLINGO-SUB%20id%3D%22lingo-sub-3056482%22%20slang%3D%22en-US%22%3EUnknownError%20(503)%20when%20calling%20Graph%20API's%20%2Fcalendar%2Fevents%20for%20some%20users%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3056482%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%20when%20using%20the%20%2Fcalendar%2Fevents%20API%2C%20it%20returns%20%22Unknown%20Error%22%20for%20some%20users%2C%20but%20works%20OK%20for%20others.%20It%20reproduces%20consistently%20for%20at%20least%202%20months.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EExample%20request%3A%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EGET%20%3CA%20href%3D%22https%3A%2F%2Fgraph.microsoft.com%2Fv1.0%2Fusers%2F07f20085-cd3e-4532-a59e-b454de5b62ea%2Fcalendar%2Fevents%3F%24select%3Did%26amp%3B%24top%3D1%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgraph.microsoft.com%2Fv1.0%2Fusers%2F07f20085-cd3e-4532-a59e-b454de5b62ea%2Fcalendar%2Fevents%3F%24select%3Did%26amp%3B%24top%3D1%3C%2FA%3E%3CBR%20%2F%3EAuthorization%3A%20Bearer%20%25token%25%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3CP%3EAnd%20we%20get%20the%20following%20response%20(the%20message%20is%20abbreviated%20for%20brevity)%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-json%22%3E%3CCODE%3E%22error%22%3A%20%7B%0A%20%20%22code%22%3A%20%22UnknownError%22%2C%0A%20%20%22message%22%3A%20%22%5Cr%5Cn%5Cr%5Cn%5Ct%26lt%3Bmeta%20charset%3D%22%5C%22utf-8%5C%22%22%20%2F%26gt%3B%5Cr%5Cn%5Ct%26lt%3Bmeta%20http-equiv%3D%22%5C%22X-UA-Compatible%5C%22%22%20content%3D%22%5C%22IE%3Dedge%5C%22%22%20%2F%26gt%3B%5Cr%5Cn%5Ct%26lt%3Bmeta%20name%3D%22%5C%22viewport%5C%22%22%20content%3D%22%5C%22width%3Ddevice-width%2C%22%20initial-scale%3D%221.0%2C%22%20user-scalable%3D%22yes%5C%22%22%20%2F%26gt%3B%5Cr%5Cn%5Ct%3CTITLE%3EService%20Unavailable%3C%2FTITLE%3E%20%26lt%3B..%26gt%3B%22%2C%0A%20%20%22innerError%22%3A%20%7B%0A%20%20%20%20%22date%22%3A%20%222022-01-10T20%3A24%3A26%22%2C%0A%20%20%20%20%22request-id%22%3A%20%22ce045d30-8f55-43ee-bddf-25d11f0766a6%22%2C%0A%20%20%20%20%22client-request-id%22%3A%20%22ce045d30-8f55-43ee-bddf-25d11f0766a6%22%0A%20%20%7D%0A%7D%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20error%20message%20is%20unfortunately%20unhelpful%3A%20there're%20no%20details%20as%20to%20what%20is%20wrong.%3C%2FP%3E%3CP%3EWhat%20we%20did%3A%3CBR%20%2F%3E1)%20Made%20sure%20the%20user%20has%20a%20cloud%20solution%20(i.e.%20not%20on-premises)%3CBR%20%2F%3E2)%20Asked%20the%20organization's%20admin%20to%20check%20if%20there's%20any%20difference%20between%20users%20for%20which%20the%20API%20works%20and%20for%20which%20the%20API%20doesn't%3B%20apparently%2C%20nothing%20suspect%20found%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhat%20can%20be%20the%20cause%20of%20this%20%22UnknownError%22%20response%3F%20Is%20this%20a%20bug%20on%20the%20Teams%20side%2C%20or%20is%20it%20a%20misconfiguration%20in%20the%20affected%20organization%3F%20Maybe%20there's%20some%20permissions%20that%20we're%20missing%20(even%20though%20it%20works%20OK%20for%20other%20orgs)%3F%20We're%20out%20of%20ideas.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3056482%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EMicrosoft%20Teams%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
New 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.
We support Ukraine and condemn war. Push Russian government to act against war. Be brave, vocal and show your support to Ukraine. Follow the latest news HERE