Reputation: 167
I'm a developer working on an add-in for Microsoft Outlook, and we've been encountering a login issue with some of our users.
In our code, one of the ways we validate users with our system is by comparing the email address retrieved from Office.js to the email address we have stored for them on the server.
We get the email address from Office.js using Office.context.mailbox.userProfile.emailAddress
and match it to the email address from the ‘me’ endpoint (https://outlook.office365.com/api/v2.0/me
) but these two don't always return the same address.
It seems that the mismatch might have something to do with when the user has a new primary alias or has switched to a new domain.
I have a few questions:
Thank you!
Upvotes: 1
Views: 269
Reputation: 33124
A user
can have more than one email address. By the default, the /me
endpoint only returns the primary email address. The rest are held in the proxyAddresses
property.
You can ask /me
to return the additional properties by adding it to a select
clause like this:
/me?$select=proxyAddresses,displayName,id,jobTitle,mail,userPrincipalName
Upvotes: 1