I get the following error when Updating a user using Microsoft Graph Beta. Permissions should not be an issue as I'm using the following permissions: user.readwrite.all, directory.readwrite.all. Also, HireDate is of type DateTimeOffSet that I'm getting by converting local DateTime to DateTimeOffSet. So, that should not be an issue either. Question: What could be the cause of the error and how can it be fixed?
Error:
Microsoft.Graph.ServiceException
HResult=0x80131500
Message=Code: BadRequest
Message: The request is currently not supported on the targeted entity set
Inner error:
AdditionalData:
date: 2020-08-31T13:59:10
request-id: 4b62576f-6572-414c-b9ef-07ea9a61c101
ClientRequestId: 4b62576f-6572-414c-b9ef-07ea9a61c101
Code:
private async void DataGridUserUpdateButton_Click(object sender, RoutedEventArgs e)
{
GraphServiceClient graphClient = new GraphServiceClient(authProvider);
User user = (sender as Button).DataContext as User;
string id = user.UserPrincipalName;
var user = new User
{
Department = "IT",
DisplayName = "Bob Doe",
HireDate = new DateTime(2020, 8, 31, 2, 30, 0),
JobTitle = "IT Manager"
};
await graphClient.Users[sId]
.Request()
.UpdateAsync(user);
}
