Create group with classification

MVP

Hello,

I'm trying to create new group with predefined classification (tenant-level groups settings with ClassificationList were successfully created via PowerShell - using approach from the following article https://joachimloe.com/2018/01/19/classifications-for-office365-groups-and-microsoft-teams/. In my test I also use 3 classifications: Internal,External,Confidential).

 

When I tried to create new Group via Graph client library for .Net and specified Classification explicitly:

var newGroup = new Microsoft.Graph.Group
{
    DisplayName = displayName,
    Description = description,
...
    Classification = "Confidential"
};
...
var addedGroup = await graphClient.Groups.Request().AddAsync(newGroup);

I got the following error: Property 'classification' is read-only and cannot be set.

 

When I tried to update classification of existing group via Graph API:

https://graph.microsoft.com/v1.0/groups/{groupId}
{
    "classification" : "internal"
}

then got Bad request with the same error: Property 'classification' is read-only and cannot be set.

 

The only method which uses classification for creating new group which I found at the moment is CreateGroupEx from Sharepoint API:

POST https://{tenant}.sharepoint.com/_api/GroupSiteManager/CreateGroupEx
{"displayName":"Test","alias":"Test","isPublic":false,"optionalParams":{"Description":"","CreationOptions":{"results":[]},"Classification":"External"}}

 

Is there a way to specify classification for the group via Graph API?

1 Reply

For those who is interested: it is possible to set group's classification, but with beta API version, not with v1.0. Same approach is used in OfficeDevPnP's SiteExtension.SetSiteClassification method: https://github.com/SharePoint/PnP-Sites-Core/blob/master/Core/OfficeDevPnP.Core/Extensions/SiteExten...