I've some issues with the Graph API. I create a user (userPrincipalName = 001XX1234@domain.com), assign a licence, but i'm not able to add an alias or set the primary SMTP address.
Tried to use otherMails, but i can't get it to work ... (no error either).
var token = await GetToken();
var client = new GraphServiceClient(new DelegateAuthenticationProvider((requestMessage) => { requestMessage.Headers.Add("Authorization", "Bearer " + token);
return Task.FromResult(0);
}));
var user = new User
{
OtherMails = new List<String>()
{
"testalias@domain.com"
}
};
await client.Users["001XX1234@domain.com"].Request().UpdateAsync(user);
Also tried
OtherMails = new[] { "testalias@domain.com" }
Any ideas?
Update 15. January 2020:
Still no success ...
var token = await GetToken();
var client = new GraphServiceClient(new DelegateAuthenticationProvider((requestMessage) =>
{
requestMessage.Headers.Add("Authorization", "Bearer " + token);
return System.Threading.Tasks.Task.FromResult(0);
}));
var blaaaa = await client
.Users["001XX1234@domain.com"]
.Request()
.UpdateAsync(new User()
{
OtherMails = new[] { "testalias@domain.com" },
GivenName = "Peter",
DisplayName = "Hansen, Peter",
Surname = "Hansi"
});
It works for GivenName, DisplayName and Surname, but not for the mail.