Microsoft Graph API - Messages

Bruno Lachot 6 Reputation points
2020-06-24T16:17:08.173+00:00

Hello,

By using Graph API to retrieve user messages, How identify emails sent and emails received by the user.

Sender or From properties can be different from user userPrincipalName if alias are used or if account created with a gmail address...

Moreever the filters on the user profile do not seem to work on personal accounts.
https://graph.microsoft.com/v1.0/me/?$select=userPrincipalName,mail,otherMails

Thank you for your help.

Best Regards

Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
19,502 questions
0 comments No comments
{count} vote

5 answers

Sort by: Newest
  1. Bruno Lachot 6 Reputation points
    2020-07-21T18:03:47.57+00:00

    Thanks for your answer.
    Regards.


  2. Bruno Lachot 6 Reputation points
    2020-07-20T22:01:53.877+00:00

    I don't think that this request
    https://graph.microsoft.com/v1.0/users/id/?$select=userPrincipalName,mail,otherMails
    does not seem to work on a personal account


  3. Saurabh Sharma 23,676 Reputation points Microsoft Employee
    2020-07-15T23:04:08.397+00:00

    @BrunoLachot-3318 Thanks for sharing your solution as it will help other community members as well.
    Here are my findings - sender.emailAddress.Address is not userPrincipalName. Application needs to query the userObject [graph.microsoft.com/v1.0/users{id | userPrincipalName}] to find all the possible email aliases and match that with senderEmailAddress.
    Regarding $select, the support for $select is yet to be added for Microsoft Accounts.

    0 comments No comments

  4. Bruno Lachot 6 Reputation points
    2020-06-26T23:53:30.197+00:00

    Thank you for your comments.

    Waiting for your additional information, I found another way via the beta API https://graph.microsoft.com/beta/me/profile/emails
    I can retrieve all mail addresses for account user. From there I can deduce if emails have been sent or received by the user.

    Regards.

    0 comments No comments

  5. Saurabh Sharma 23,676 Reputation points Microsoft Employee
    2020-06-26T20:12:27.677+00:00

    @BrunoLachot-3318 I do no see any attributes in message object to identify if it is a sent or received one. I suggest you to reach out to Microsoft Graph Support to provide your feedback.

    Also, I am able to reproduce your other issue and $select is not working if I log in with Personal (Guest) account. I am checking internally on this issue and update you here on the same.

    1 person found this answer helpful.
    0 comments No comments