Search code examples
node.jsoauth-2.0outlookazure-active-directory

Access calendar events with Microsoft Graph using Nodejs


I am trying to access Outlook Calendar events endpoint From the following graph API app, with the following permissions Calendar.read & Calendar.ReadWrite

I am getting below Error : { "error": { "code": "OrganizationFromTenantGuidNotFound", "message": "The tenant for tenant guid '2491fc8b-6fab-41bb-90be-759045024960' does not exist.", "innerError": { "request-id": "1653871f-32b8-4e0e-9fe3-dbefdfee4638", "date": "2020-04-29T04:06:48" } } }

enter image description here


Solution

  • The issue was caused by the Azure AD doesn't have O365 subscription. I created an Azure AD tenant which doesn't have O365 subscription and got the same error with yours.

    Apart from this, if you resolve the O365 subscription problem later, you still need to do some change on your request. According to the screenshots you provided, you get the access token by "client_credentials" grant flow, so the access token is application identity but not user identity. So you can't use me in your graph api https://graph.microsoft.com/v1.0/me/events. We should request the graph api by:

    https://graph.microsoft.com/v1.0/users/{id | userPrincipalName}/events