Error access denied while using /users/<userid>/mailFolders api

CheeryB 1 Reputation point
2022-09-27T21:16:34.137+00:00

Hi,

I'm using Graph explorer to get mailfolders of my users. I'm constantly seeing this below error message for every other user.

{
"error": {
"code": "ErrorAccessDenied",
"message": "Access is denied. Check credentials and try again.",

Please help me settle this issue. Really appreciate any help!!

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,902 questions
{count} votes

1 answer

Sort by: Most helpful
  1. HarmeetSingh7172 4,811 Reputation points
    2022-09-27T21:51:59.56+00:00

    Hi @CheeryB

    Thanks for reaching out!

    You are getting this error because you are using Graph Explorer tool to test GET /users/{id | userPrincipalName}/mailFolders endpoint.

    Graph Explorer can only work with Delegated Permissions i.e., GET /me/mailFolders

    To check other users' mailfolders, you need to add Application Permissions ( Mail.ReadBasic.All, Mail.Read, Mail.ReadWrite ) in your Azure application, generate an application token and then test this GET /users/{id | userPrincipalName}/mailFolders endpoint in Postman Tool.

    Refer- List Mail Folders

    Hope this helps.

    If the answer is helpful, please click Accept Answer and kindly upvote it. If you have any further questions about this answer, please click Comment.

    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.