Facing access denied error while accessing emails from shared maibox through graph API

Siddhesh Gholap 0 Reputation points
2024-08-19T06:50:10.2366667+00:00

Hello

I want to access a shared mailbox with Microsoft Graph. I am currently trying to get a response with Graph Explorer. What I found so far to access a shared mailbox is the following GET request: "https://graph.microsoft.com/v1.0/users/{sharedmailboxmailaddress}/messages" as a respond I get:

{ "error": { "code": "ErrorAccessDenied", "message": "Access is denied. Check credentials and try again.", "innerError": { "date": "2020-08-28T08:39:00", "request-id": "ba9bddb6-601e-4d37-a787-3e2e474ce72b" } } }

I have provided Following API delegated permissions - Mail.Read, Mail.Read.Shared, Mail.ReadWrite , Mail.ReadWrite.Shared , Mail.Send , Mail.Send.Shared.

How should I resolve this issue or what extra permission should i give ?

Microsoft Security Microsoft Graph
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. CarlZhao-MSFT 46,371 Reputation points
    2024-08-19T08:11:32.88+00:00

    Hi @Siddhesh Gholap

    It is not possible to directly list all emails in a shared mailbox. When the target user shares their mailbox with you, only the Inbox folder is shared by default, so you can only retrieve emails from the Inbox folder of the shared mailbox.

    GET /users/{sharedmailboxmailaddress}/mailFolders/{id}/messages
    

    If you want to access emails in other folders of the shared mailbox, you need to contact the target user and ask them to share the other folders with you in Outlook.

    Hope this helps.

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


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.