Access denied when fetching mails of organization users

Rajat M Jain 41 Reputation points
2021-03-19T12:20:43.003+00:00

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@jaswant .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
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
13,049 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Deva-MSFT 2,266 Reputation points Microsoft Employee
    2021-03-20T04:20:42.06+00:00
    • 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.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.