Share via

Fetching Email content with Microsoft graph API using admin credentials

Shivani Mandeliya 1 Reputation point
2021-08-17T10:11:59.497+00:00

I am trying to retrieve the outlook messages of an user using the following API end point -

https://graph.microsoft.com/v1.0/users/{userPrincipalName}/messages

However, it is not working at all. I am the admin and hence using my own credentials (instead of using an app)
It works fine if I want to see my own data with this call - https://graph.microsoft.com/v1.0/users/me/messages

Microsoft Security | Microsoft Graph
0 comments No comments

1 answer

Sort by: Most helpful
  1. Deva-MSFT 2,276 Reputation points Microsoft Employee Moderator
    2021-09-06T06:36:14.9+00:00

    You need to do the following:

    • Some apps call Microsoft Graph with their own identity and not on behalf of a user (say, Client Credential flow). For this you need to start with setting authentication/authorization steps as described here[https://learn.microsoft.com/en-us/graph/auth-v2-service#authentication-and-authorization-steps] and the detailed steps.
    • Configure the permissions for Microsoft Graph
    • Get admin consent, get access token and use it to call Graph
    • Now you can access the other user mailbox and its items.

    Was this answer helpful?

    0 comments No comments

Your answer

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