Microsoft Graph Api for Mail and other features

Mitul Dave 0 Reputation points
2023-05-22T04:22:38.1933333+00:00

Hello,

I am facing issues fetching emails using Microsoft graph api.

I did the authentication using the APIs and by using that retrieved token I am able to get the profile information but at the same time when I am trying to get the email then it is asking that "you do not have the privilege.

So please let me know that can i access the email feature with trial account while development, if yes then please let me know the process and all the details.

Microsoft Security | Microsoft Graph
{count} votes

1 answer

Sort by: Most helpful
  1. CarlZhao-MSFT 46,371 Reputation points
    2023-05-22T05:59:01.6833333+00:00

    Hi @Mitul Dave

    If you're trying to get the logged-in user's email information, then you need to grant your app one of the Mail.ReadBasic, Mail.Read or Mail.ReadWrite delegated permissions and grant administrator or user consent for that permission.

    3

    Then use a delegated authentication flow to obtain an access token, such as the auth code flow or ROPC flow.

    Finally call the List messages graph API endpoint to get the email of the logged in user:

    User's image

    Hope this helps.

    If the reply is helpful, please click Accept Answer and kindly upvote it. If you have additional questions about this answer, please click Comment.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.