我正在尝试从.Net Core应用程序使用Microsoft Graph API添加备用电子邮件。
Microsoft Graph中的user
类没有提供用于添加附加邮件标识的属性。
我正在尝试从.Net Core应用程序使用Microsoft Graph API添加备用电子邮件。
Microsoft Graph中的user
类没有提供用于添加附加邮件标识的属性。
otherMails
中。以下是更新此属性的示例:PATCH: https://graph.windows.net/{tenant}/me?api-version=1.6
authorization: bearer {access_token}
{
"otherMails":["test@test.com"]
}
请参考以下链接,了解用户实体和更新用户REST:
Select(u => new {
u.DisplayName,
u.Mail,
u.UserPrincipalName,
u.OtherMails
})
.GetAsync();
您可以从Graph API文档中的用户的"otherMails"属性中获取备用电子邮件。
请注意,这仅在选择时返回,因此您需要包括查询参数"$select=otherMails"才能看到它。
GET https://graph.microsoft.com/v1.0/users/USER_ID?$select=otherMails
authorization: bearer {access_token}
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users(otherMails)",
"@odata.id": "https://graph.microsoft.com/v2/YOUR_AAD_TENANT/directoryObjects/USER_ID/Microsoft.DirectoryServices.User",
"otherMails": [
"altEmail@website.com"
]
}