Is there a way to get the User Primary Email Address Using MS Graph

yeison bernal 21 Reputation points
2022-03-25T14:17:55.433+00:00

I have been working with Outlook 365 Synchronization , and we are having issues with users that use a Primary email address that is different from UserName.
I was checking the documentation of MS Graph and I can't find a way to relate a UserName with a Primary email address of an specific User.

186989-image.png

does this 2 emails have the same Id ? or is it possible to get from MS Graph , I have tried with different properties (mail, identities, otherMails)

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

1 answer

Sort by: Most helpful
  1. Zehui Yao_MSFT 5,846 Reputation points
    2022-03-29T07:28:39.91+00:00

    Hello @yeison bernal , the otherMails property can list additional email address for the user, try to get user by primary email address using following API.

    https://graph.microsoft.com/v1.0/users?$filter=otherMails/any(c:c eq '{Primary Email Address }')  
    

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.