DaveEP
DaveEP

Reputation: 1496

C# Graph API - Setting IsRead - Access Denied

I am having problems setting the IsRead property when reading email, and after lots of Googling the following appears to be the code required.

await Client.Me.Messages[m.Id].Request().Select("IsRead").UpdateAsync(new Message() { IsRead = true });
                           

The problem is this is returning:

Mail Exception: Code: ErrorAccessDenied

Message: Access is denied. Check credentials and try again

ClientRequestId: (the id here)

The Microsoft Graph Docs says the permissions required are Mail.ReadWrite. I have confirmed we have that.

Other problems on Stackoverflow include Fails to mark as read, but my problem is one of access denied, rather than trying to set read-only properties.

I've also tried the code from here: Github Graph Issue but again, I'm getting Access Denied.

The app has the following permissions: Mail.Read

Mail.ReadBasic

Mail.ReadBasicAll

Mail.ReadWrite

Mail.Send

MailboxSettings.Read

MailboxSetings.ReadWrite

User.Read

User.ReadAll

Is there anything else required?

Upvotes: 2

Views: 826

Answers (1)

Dev
Dev

Reputation: 2464

  • As you can repro the issue with all the messages, i suggested to try the same with Microsoft Graph explorer outside of the code.
  • Based on your check, you found that the endpoint was the problem. By providing the right endpoint, it worked.

Upvotes: 2

Related Questions