2
votes

I had created a Azure active directory v1 in azure for the OAuth connection settings to the bot. I got the user's access token successfully, then I make call to GET https://graph.microsoft.com/v1.0/me with an Authorization: Bearer header.

{
   "@odata.context": 
   "https://graph.microsoft.com/v1.0/$metadata#users/$entity",
   "businessPhones": [],
   "displayName": "Ram kumar",
   "givenName": "kumaran raju",
   "jobTitle": null,
   "mail": null,
   "mobilePhone": null,
   "officeLocation": null,
   "preferredLanguage": null,
   "surname": "10sa788ad8df-457kdj9dsfs-78d7a8df6a6-7d7a887df7a9",
   "userPrincipalName": "something",
   "id": "4532523589023895"
}

The above response which I got from that API. But I need to access the user's mail property, which gives only null. So, how I get the logged in user's mail from this response?

1

1 Answers

3
votes

It means the user does not have the mail property. The mail is read-only which is the SMTP address for the user. It is tied to Exchange Online, you could not write to that attribute unless you have an Exchange Online license, when you activate a license for the user, Exchange Online will update the field with the correct mailbox mail address during the creation of the user's mailbox.

For more details, you could refer to this link.