Hi @Declan ,
Microsoft Graph Explorer app executes Microsoft Graph APIs under delegated permissions scope. When delegated permissions scope is being used, Mail.ReadBasic, Mail.Read only provides access to the authenticated user's mailbox (the only exception being those that have been explicitly shared with that user). When application permissions scope is being used, Mail.ReadBasic.All, Mail.Read provides access to any user's mailbox.
As mentioned in this documentation ,there are two scenarios where an app can get messages in another user's mail folder:
- If the app has application permissions, or,
- If the app has the appropriate delegated permissions from one user, and another user has shared a mail folder with that user, or, has given delegated access to that user. You can use the delegated permissions, Mail.Read.Shared or Mail.ReadWrite.Shared, to respectively read or write messages in a shared or delegated folder. See Get Outlook messages in a shared or delegated folder to help you achieving this.
As an example, Shared "Inbox" mail floder of another user : demouser@o365XXXX.onmicrosoft.com and able to access that user's "Inbox" folder emails :
GET https://graph.microsoft.com/v1.0/users/{Other User's -userId | -userPrincipalName}/mailfolders('Inbox')/messages
Example:
GET https://graph.microsoft.com/v1.0/users/demouser@o365XXXX.onmicrosoft.com/mailfolders('Inbox')/messages
Exchange Online Administrators can be able to grant the permissions on user's mailboxes from Exchange Online Admin Center.
Below Graph API can be used to fetch email messages of an user :
GET https://graph.microsoft.com/v1.0/users/{id | userPrincipalName}/messages
Example :
GET https://graph.microsoft.com/v1.0/users/sampleuser@o365XXXX.onmicrosoft.com/messages
References:
Please refer the below documenation links for more information on this:
https://learn.microsoft.com/en-us/graph/api/user-list-messages?view=graph-rest-1.0&tabs=http
https://learn.microsoft.com/en-us/graph/outlook-share-messages-folders
Hope this helps.
If the answer is helpful, please click "Accept Answer" and kindly upvote it ,so that it will be helpful to the other community users. If you have any further questions about this answer, please click "Comment".