简体   繁体   中英

Microsoft Azure AD graph API, How to get the user mail in response with botbuilder version 4 in node js?

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?

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM