question

RajatMJain-7521 avatar image
0 Votes"
RajatMJain-7521 asked Deva-MSFT answered

Access denied when fetching mails of organization users

Assume the organization is abc.onmicrosoft.com.
After having logged in as a user with Global Administrator and having granted all the required permissions in the Graph Explorer, the following query-
"https://graph.microsoft.com/v1.0/users/some_user@abc.onmicrosoft.com/messages"
The following is the response-
{
"error": {
"code": "ErrorAccessDenied",
"message": "Access is denied. Check credentials and try again.",
"innerError": {
"date": "2021-03-19T08:10:19",
"request-id": "ffb0c7bd-8194-4fa4-afa4-22d1af483e2e",
"client-request-id": "4195b1bc-7d86-9209-1c0b-a71396ccc5cb"
}
}
}

microsoft-graph-mail
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

Deva-MSFT avatar image
0 Votes"
Deva-MSFT answered
  • I believe you're using Client Credentials grant flow above and you want to access the other user mailbox's email items. Make sure that you have the necessary permissions to access the other user mailbox. Validate the token at https://jwt.ms and see you have the necessary permissions/scopes defined. For more information, refer the detailed step-by-step documentation which talks about the same.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.