4
votes

I am trying to add an alternate email with Microsoft Graph API from a.Net Core app.

The user class in Microsoft Graph does not provide a property for adding an additional mail id.

2
Do you still have the issue about this problem? If yes, please feel free to let me know.Fei Xue - MSFT
What exactly have you tried? Where are you stuck?Nico Haase

2 Answers

5
votes

You can using Azure AD Graph to add the mail id to the otherMails. Here is sample to update the this property:

PATCH: https://graph.windows.net/{tenant}/me?api-version=1.6
authorization: bearer {access_token}

{
"otherMails":["[email protected]"]
}

Refer the links below for the user entity and update user REST:

Entity and complex type reference | Graph API reference

Update User

1
votes

Here is the C# code to retrieve the alternate email

Select(u => new {
    u.DisplayName,
    u.Mail,
    u.UserPrincipalName,
    u.OtherMails
})
.GetAsync();