How can I add an organization to tenant guid ( error: OrganizationFromTenantGuidNotFound )

jared gibb 6 Reputation points
2021-09-15T16:46:42.83+00:00

I am setting up microsoft graph auth and API calls for the firs time in a new app.

i can successfully authenticate a user, return access and refresh tokens, then make the first call to get my profile info.

I can even make this call as the app and not a 'user'.

where i am running into issues is making calls to get my calendar by adding /calendars to the end of my profile call. when I do this I get this error:

{ 
  "error": { 
    "code": "OrganizationFromTenantGuidNotFound", 
    "message": "The tenant for tenant guid    '1dd120fe-cbd9-492b-b36d-12e4aa856cf3' does not exist.", 
    "innerError ": { 
      "oAuthEventOperationId ": "    ae00f89a - 1 d34 - 4299 - af82 - 93 d5c0409ada ", 
      " oAuthEventcV ": "  mJu0K0YLfbqLxFewMqMcug .1 .1 ", 
      "errorUrl ": "https: //aka.ms/autherrors#error-InvalidTenant", 
      "requestId": "ae055090-cad5-4b0f-ad7b-9c0731c75bd4", 
      "date": "2021-09-15T16:18:10" 
    } 
  } 
}

as a note, I get the same error when making the call as either the user whose calendar I am requesting or as the application.

in the application I do have the permissions set like this
Permissions

and for reference, here is the URL I am calling that works

https://graph.microsoft.com/v1.0/users/d4d0b2ef-6a3b-4254-b8bb-eb358194458b 

and the one that does not

https://graph.microsoft.com/v1.0/users/d4d0b2ef-6a3b-4254-b8bb-eb358194458b/calendars 

1:

here is a video of the issue

https://vimeo.com/605796641

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,582 questions
0 comments No comments
{count} vote

1 answer

Sort by: Most helpful
  1. Shweta Choudhary 601 Reputation points Microsoft Employee
    2021-09-17T20:08:03.023+00:00

    Thank you for reaching out.

    It could be because Azure AD you created does not have Office 365. Thus it cannot have calendars. /users works because that is an Azure AD endpoint.

    If you want to access calendars for your development O365 tenant, register the app in your O365 AAD tenant that you got when you created the development tenant

    Follow the steps below -

    1. You need a Microsoft office 365 account with a subscription, can get this by applying for one on office 365 develop.
    2. Upon creating one, follow the instructions and add the apps to it.
    3. Go to Azure Portal and log in with your office 365 account.
    4. Create an app under AAD -> App registration
    5. Try to access https://graph.microsoft.com/v1.0/users/{user_id}/calendars.

    Hope this helps.

    1 person found this answer helpful.
    0 comments No comments