Issue with graph client accessing shared mailbox
batmanalien opened this issue · 3 comments
batmanalien commented
I have a shared mailbox that I want to read the inbox messages. I modified the GetMyInboxMessages
method and got an Access Denied
error, even if I have full access.
Any idea how to get this to work for my shared mailbox (where the user id is a GUID in the example below)?
public async Task<List<ResultsItem>> GetMyInboxMessages(GraphServiceClient graphClient)
{
List<ResultsItem> items = new List<ResultsItem>();
IMailFolderMessagesCollectionPage messages = await graphClient
.Users["0f4331c1-57c1-48b1-8374-edd4f58b8c73"]
.MailFolders
.Inbox
.Messages
.Request()
.GetAsync();
if (messages?.Count > 0) {
foreach (Message message in messages) {
items.Add(new ResultsItem {
Display = message.Subject,
Id = message.Id
});
}
}
return items;
}
shriramdevanathan commented
Were u able to resolve this ?
batmanalien commented
No, I was not able to resolve this error :(
…On Mon, Jun 11, 2018 at 6:41 AM shriramdevanathan ***@***.***> wrote:
Were u able to resolve this ?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#36 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ARuLPZ8DqT5_z3Q_w7yPzY-pMUN6-7koks5t7mWEgaJpZM4SaqoH>
.
jasonjoh commented
I know this is an old issue, but I wanted to post an answer anyway. In order for your code to work, you need two things:
- The mailbox owner must have shared their mailbox with you
- The app must request (and you must consent to) either
Mail.Read.Shared
orMail.ReadWrite.Shared
.
See https://docs.microsoft.com/graph/outlook-share-messages-folders