Simply put, not every user object within Azure AD has an email address. null is a valid value for the mail property. And userPrincipalName is a different thing altogether, not necessarily related to the mail property.
/me endpoint sometimes has blank 'mail' property
Leo B
6
Reputation points
Got some questions about /me endpoint
- What are the possible reasons as to why
mail
will be undefined? - What can be done to get a value in the
mail
property? - If it cannot be filled, what is a viable alternative?
- I've checked userPrincipalName and it looks like an email, but I've noticed that for some users, it does not match the
mail
property which means it's not a reliable alternative. Is this correct?
Thanks.