I am developing an azure web app service called emailservice, which is supposed to communicate to a mailbox created in office365 exchange online. Suppose the user account for the mailbox is x @y-domain.com. The webapp is supposed to retrieve messages automatically form the inbox or send messages when an special events happen. I have decided to use Microsoft graph api for this matter. I need to do app registration. I am not sure whether I should use user+app access or app-only access. I am not sure if both of accesses are possible, and it is just matter of choice which one to use. I have seen code snippet where they suggest to have app only access + Mail.ReadWrite and Mail.Send permissions. Again, I am not sure it is just a matter of choice or user+app access can be used for this scenario as well. I would appreciate if someone shed some light on this.
I have some Microsoft documents but not sure which one is suitable or whether both of them possible for the scenario I described.
I registered one Azure AD application and granted
Mail.Readpermission of Delegated type like this:With Delegated permissions, you can only read mails of signed-in user(/me endpoint) and shared mailbox.
User+App access in C# (Interactive flow):
Response:
For this, I registered one application and granted permissions of Application type as below:
With Application permissions, you can read mails of any user present in the tenant without any login to acquire token.
App-only access in C# (Client credentials flow)
Response: