Create group with classification

%3CLINGO-SUB%20id%3D%22lingo-sub-197665%22%20slang%3D%22en-US%22%3ECreate%20group%20with%20classification%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-197665%22%20slang%3D%22en-US%22%3E%3CP%3EHello%2C%3C%2FP%3E%3CP%3EI'm%20trying%20to%20create%20new%20group%20with%20predefined%20classification%20(tenant-level%20groups%20settings%20with%20%3CSPAN%20class%3D%22crayon-s%22%3EClassificationList%3C%2FSPAN%3E%20were%20successfully%20created%20via%20PowerShell%20-%20using%20approach%20from%20the%20following%20article%20%3CA%20href%3D%22https%3A%2F%2Fjoachimloe.com%2F2018%2F01%2F19%2Fclassifications-for-office365-groups-and-microsoft-teams%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fjoachimloe.com%2F2018%2F01%2F19%2Fclassifications-for-office365-groups-and-microsoft-teams%2F%3C%2FA%3E.%20In%20my%20test%20I%20also%20use%203%20classifications%3A%20%3CSPAN%20class%3D%22crayon-s%22%3EInternal%2CExternal%2CConfidential%3C%2FSPAN%3E).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhen%20I%20tried%20to%20create%20new%20Group%20via%20Graph%20client%20library%20for%20.Net%20and%20specified%20Classification%20explicitly%3A%3C%2FP%3E%3CPRE%3Evar%20newGroup%20%3D%20new%20Microsoft.Graph.Group%3CBR%20%2F%3E%7B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20DisplayName%20%3D%20displayName%2C%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Description%20%3D%20description%2C%3CBR%20%2F%3E%20%20%20%20...%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Classification%20%3D%20%22Confidential%22%3CBR%20%2F%3E%7D%3B%3CBR%20%2F%3E...%3CBR%20%2F%3Evar%20addedGroup%20%3D%20await%20graphClient.Groups.Request().AddAsync(newGroup)%3B%3C%2FPRE%3E%3CP%3EI%20got%20the%20following%20error%3A%20Property%20'classification'%20is%20read-only%20and%20cannot%20be%20set.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhen%20I%20tried%20to%20update%20classification%20of%20existing%20group%20via%20Graph%20API%3A%3C%2FP%3E%3CPRE%3Ehttps%3A%2F%2Fgraph.microsoft.com%2Fv1.0%2Fgroups%2F%7BgroupId%7D%3CBR%20%2F%3E%7B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22classification%22%20%3A%20%22internal%22%3CBR%20%2F%3E%7D%3C%2FPRE%3E%3CP%3Ethen%20got%20Bad%20request%20with%20the%20same%20error%3A%20Property%20'classification'%20is%20read-only%20and%20cannot%20be%20set.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20only%20method%20which%20uses%20classification%20for%20creating%20new%20group%20which%20I%20found%20at%20the%20moment%20is%20CreateGroupEx%20from%20Sharepoint%20API%3A%3C%2FP%3E%3CPRE%3EPOST%20https%3A%2F%2F%7Btenant%7D.sharepoint.com%2F_api%2FGroupSiteManager%2FCreateGroupEx%3CBR%20%2F%3E%7B%22displayName%22%3A%22Test%22%2C%22alias%22%3A%22Test%22%2C%22isPublic%22%3Afalse%2C%22optionalParams%22%3A%7B%22Description%22%3A%22%22%2C%22CreationOptions%22%3A%7B%22results%22%3A%5B%5D%7D%2C%22Classification%22%3A%22External%22%7D%7D%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIs%20there%20a%20way%20to%20specify%20classification%20for%20the%20group%20via%20Graph%20API%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-197665%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EGroups%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EOffice%20365%20Groups%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESharePoint%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-198181%22%20slang%3D%22en-US%22%3ERe%3A%20Create%20group%20with%20classification%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-198181%22%20slang%3D%22en-US%22%3E%3CP%3EFor%20those%20who%20is%20interested%3A%20it%20is%20possible%20to%20set%20group's%20classification%2C%20but%20with%20beta%20API%20version%2C%20not%20with%20v1.0.%20Same%20approach%20is%20used%20in%20OfficeDevPnP's%20SiteExtension.%3CSPAN%20class%3D%22pl-en%22%3ESetSiteClassification%3C%2FSPAN%3E%20method%3A%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FSharePoint%2FPnP-Sites-Core%2Fblob%2Fmaster%2FCore%2FOfficeDevPnP.Core%2FExtensions%2FSiteExtensions.cs%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2FSharePoint%2FPnP-Sites-Core%2Fblob%2Fmaster%2FCore%2FOfficeDevPnP.Core%2FExtensions%2FSiteExtensions.cs%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
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...