I am trying to update the sensitivity label on a office 365 group using graph api as shown here, however I always keep receiving error.
I am refering this link(https://docs.microsoft.com/en-us/microsoft-365/compliance/sensitivity-labels-teams-groups-sites?view=o365-worldwide) where I saw recently microsoft has released public preview of this sensitivity label feature which can be applied on groups or teams. In my tenant the sensitivity feature has been enabled.
Below is the code which I am using for updating label. I am using latest version of Microsoft.Graph
package from nuget.
MSGraph.GraphServiceClient graphClient = GetAuthenticatedClient();
string grpId = "<group id here>"; // irrelevant not shown here how group id is acquired
var groupToUpdate = new Group
{
AssignedLabels = new List<AssignedLabel>()
{
new AssignedLabel
{
LabelId = "480dd7e5-2378-47bc-a023-511ad6a967ce"
}
}
};
graphClient.Groups[grpId].Request().UpdateAsync(groupToUpdate).Wait();
The error I receive is
and full stacktrace
Can anyone throw some light on what I am missing here?