Search code examples
c#microsoft-graph-apimicrosoft-graph-mail

Access denied when trying to get my MailboxSettings using Select with MailboxSettings.Read


I am trying to get MailboxSettings of the currently logged in user ("/me") using the .net graph client.

I have a working solution, using an extension method that uses "/me/mailboxSettings", but I have found out that extension methods are not easy to test, though possible, and would prefer a solution that works without one.

I have found out that using Me.Request().Select("MailboxSettings") should work as well but I get a service exception with "Access denied" using the same authentication, which has these permissions : "(...) MailboxSettings.Read User.Read User.ReadBasic.All"

Testing with the graph explorer shows that the request does generally work, though I am not sure if this is because it has more permissions as our app on azure - specfically MailboxSettings.ReadWrite, but I would not know why these should be required on a Get method.


Solution

  • I have found that MailboxSettings.Read did not work for me. I needed to consent to MailboxSettings.ReadWrite before I could actually read the settings. Could you try that and confirm if that works for you?