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

时间:2019-04-17 02:25:43

标签: azure azure-active-directory botframework microsoft-graph azure-ad-graph-api

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 个答案:

答案 0 :(得分:2)

这意味着用户没有mail属性。 mail是只读的,它是用户的SMTP地址。它与Exchange Online绑定,除非拥有Exchange Online许可证,否则您无法写入该属性,当为用户激活许可证时,Exchange Online将在创建用户邮箱时使用正确的邮箱邮件地址更新该字段。 。

有关更多详细信息,您可以参考此link