Reputation: 3
I am getting error "Access is denied" on sending a test email. Can anyone advise what settings did I missed? enter image description here
Upvotes: 0
Views: 566
Reputation: 3575
You are using the Client credential flow (App Context), so you should not use Me
here because the Microsoft Graph doesn't know the meaning of Me as it is not the user context where you are not using your user credentials.
So you should use the code something like this.
await graphClient.Users["Userid/UPN"]
.SendMail(message,saveToSentItems)
.Request()
.PostAsync();
Replace your code with above code. Make sure you give the UPN/userid of the user from whom you want to send the mail.
Upvotes: 1