I'm trying to set the value of an Azure AD user to null or string.Empty, by using the Microsoft.Graph NuGet Package in a C# app.
That's my code:
public async Task<User> UpdateMobilePhone(string userId, string mobilePhone)
{
User user = new User();
user.MobilePhone = mobilePhone;
return await graphServiceClient.Users[userId]
.Request()
.UpdateAsync(user);
}
If a set the value of "mobilePhone" to string.Empty I get the error: Microsoft.Graph.ServiceException: "Code: Request_BadRequest Message: Invalid value specified for property 'mobilePhone' of resource 'User'.
And if I set the value of "mobilePhone" to null it's happening nothing because the default value of a empty user is null so he thinks, that nothing is changed.
So does someone know how I can resolve my problem?
Thank you in forward