I have the following query to retrieve a User using the GraphServiceClient
with .net core 2.
user = await _graphClient.Users[principalName].Request()
.Expand("Extensions")
.GetAsync();
When I run this I get the following error
Microsoft.Graph.ServiceException: Code: generalException Message: Unexpected exception returned from the service.
This only happens when I have added a OpenTypeExtension
to the user using the following code!
extension = new OpenTypeExtension
{
ExtensionName = AzureADExtensions.UserConstants.ExtensionName,
AdditionalData = new Dictionary<string, object>
{
{"OtherEmail", externalUser.Email},
{"OtherRole" , externalUser.Roles.FirstOrDefault()}
}
};
await _graphClient.Users[user.Id].Extensions.Request()
.AddAsync(extension);
I am starting to get really getting fed up with Azure AD now.
I can't seem to add any meta data to my users. Only doing this because otherEmails
does not work with the GraphServiceClient
and trying to use any other sensible fields gives me this error:
Tenant does not have a SPO license when updating user
Any help would be appreciated.