Mailbox Microsoft graph subscription for any organizational directory and personal microsoft account

David Rivera 1 Reputation point
2022-09-22T00:23:36.487+00:00

Hi team, thanks in advance for your help.

Currently, we have a requirement to retrieve mail messages from external users that do not belong to our organization ( we can see them as a client or partners), from their inbox to our application, we want to discriminate depending on the user's email address involved in the email and save some data in our database to track users interactions between their clients.

In order to archive this we are considering using Microsoft graph API with a subscription to messages; instead of pulling for information every once in a while to hundreds of mailboxes.

We followed the following tutorial : nodejs-webhooks-sample and everything worked well until we log in:

243640-image.png

We have the application registered as Accounts in any organizational directory (Any Azure AD directory - Multitenant) and personal Microsoft accounts (e.g. Skype, Xbox), and we already followed the steps of the troubleshooting article : error-code-aadsts50020-user-account-identity-provider-does-not-exist and still not working. also tried with a company account and an outlook personal account.

So we have a few questions :

*is possible to archive what we looking for (get a webhook call when a new email arrives in an inbox of a user that may not exist and our tenant and after that get all the body data from that message through a different request)?
*The workflow that we think involves minimal user interaction so we like to use app permissions and not add manually to our tenant all the users that want their email retrieved
*any recommendations to the approach that are we looking for?

Hope this information helps

Have an amazing day

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,565 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Vasil Michev 95,096 Reputation points MVP
    2022-09-22T06:58:58.277+00:00

    Not entirely sure what you are trying to achieve here. External users/Guest users do not get mailboxes in Exchange Online, even when a license is assigned, that's not a supported scenario. If you want to get the content of their actual mailboxes, your application will need to have the necessary permissions (consent) within each customer's tenant, no other way of doing this.


  2. David Rivera 1 Reputation point
    2022-09-22T17:43:55.24+00:00

    A little update here @Vasil Michev , apparently the solution was to simply just change the tenantid for the "common" value on the environments variables to use the proper endpoint:

    243929-image.png

    0 comments No comments