I am listing users from SharePoint into custom database table for use in custom application. While adding these users to custom database we need the user Id from Azure Active Directory (not user ID from SharePoint).
So based on email of user from SharePoint I search the user in Azure AD and get the ID.
For some users I see that Mail field from Graph User object is null but has User Principal Name field filled with email. And for other users has both Mail and User Principal Name filled.
What is the reason Mail field for users is null? Which field should I rely on as email value?
Thank you!


