Julianit0w
Julianit0w

Reputation: 11

Error OrganizationFromTenantGuidNotFound when accessing messages Azure

I get the error "OrganizationFromTenantGuidNotFound" while trying to access to my inbox messages.

To explain I am trying to develop an app and in this app I need to access my inbox e-mails. So I try to use the Outlook API and for that I created an APP with all demanded permissions "Email.Read, Email.ReadBasics, Emails.ReadAll...". I have an Office 365 Family subscription, and an active paid azure subscription. My question is why getting my personal information works '/users/{user-id}' but when accessing to emails I got this error ? I read a lot of docs and never get an answer... Maybe my subscription does not get me access to Microsoft Exchange Online License, or due to my old microsoft address "[email protected]" maybe it is not compatible, I dont't know, if someone can help me to clear it out, would be great. Oh, and abviously my Office 365 and Azure account are the same.

I tried, with 'client credentials flow authentication' (which give me the error 'need more privileges'), went back to Authorization Code Flow Atuhentication but then I get the OrganizationFromTenantGuidNotFound error. But only on /messages endpoint, the endpoint users/{user-id} works. Obviously I tried all threads I found, even with an Office 365 Developer account but don't really see the correlation with my problem here.

Upvotes: 1

Views: 772

Answers (1)

Rukmini
Rukmini

Reputation: 15444

I tried to reproduce the same in my environment and got the same error as below:

enter image description here

To resolve the error, try the below:

I created an Azure AD Application and granted API permissions:

enter image description here

I generated access token by using below parameters:

https://login.microsoftonline.com/TenantID/oauth2/v2.0/token

client_id:ClientID
client_secret:ClientSecret
scope:https://graph.microsoft.com/.default
grant_type:client_credentials

enter image description here

To resolve the error, I added Microsoft Exchange Online License as below:

enter image description here

After assigning the license, I am able to get the messages of the user successfully as below:

https://graph.microsoft.com/v1.0/users/UserId/messages

enter image description here

If still the issue persists, check the below:

  • Check if the authentication token is matching the Tenant.
  • Check whether the User exists in the Tenant you are referring to.
  • Make sure Microsoft Exchange Online License is assigned which is included in Microsoft 365 license.

Reference:

Get message - Microsoft Graph v1.0

Upvotes: 1

Related Questions