Namespace: microsoft.graph
Create a new sharePointGroup object. The sharePointGroup only exists within the scope of the fileStorageContainer in which it was created. To add permissions for the sharePointGroup on driveItem objects, you must use the Create permission on a driveItem API. Up to 10,000 sharePointGroup objects can be created per fileStorageContainer. For more information on service limits, see SharePoint online limits.
This API is available in the following national cloud deployments.
| Global service |
US Government L4 |
US Government L5 (DOD) |
China operated by 21Vianet |
| ✅ |
❌ |
❌ |
❌ |
Permissions
Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.
| Permission type |
Least privileged permissions |
Higher privileged permissions |
| Delegated (work or school account) |
Not supported. |
Not supported. |
| Delegated (personal Microsoft account) |
Not supported. |
Not supported. |
| Application |
FileStorageContainer.Selected |
Not available. |
Note
In addition to Microsoft Graph permissions, applications calling this API must at least have the AddPermissions container type-level permission on the container type of the corresponding containers. For more information, see container types. To learn more about container type-level permissions, see SharePoint Embedded authorization.
HTTP request
POST /storage/fileStorage/containers/{fileStorageContainerId}/sharePointGroups
Request body
In the request body, supply a JSON representation of the sharePointGroup object.
You can specify the following properties when you create a sharePointGroup.
| Property |
Type |
Description |
| description |
String |
A user-visible description of the sharePointGroup. The description can't be longer than 512 characters. Optional. |
| title |
String |
The title of the sharePointGroup. The title can't be longer than 255 characters. Required. |
Response
If successful, this method returns a 201 Created response code and a sharePointGroup object in the response body.
Examples
Request
The following example shows a request that creates a new sharePointGroup that is local to a fileStorageContainer. The title and description of the sharePointGroup are shown in the request body.
POST https://graph.microsoft.com/v1.0/storage/fileStorage/containers/b!ISJs1WRro0y0EWgkUYcktDa0mE8zSlFEqFzqRn70Zwp1CEtDEBZgQICPkRbil_5Z/sharePointGroups
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.sharePointGroup",
"title": "Sample Group",
"description": "This is a sample description"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new SharePointGroup
{
OdataType = "#microsoft.graph.sharePointGroup",
Title = "Sample Group",
Description = "This is a sample description",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Storage.FileStorage.Containers["{fileStorageContainer-id}"].SharePointGroups.PostAsync(requestBody);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewSharePointGroup()
title := "Sample Group"
requestBody.SetTitle(&title)
description := "This is a sample description"
requestBody.SetDescription(&description)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
sharePointGroups, err := graphClient.Storage().FileStorage().Containers().ByFileStorageContainerId("fileStorageContainer-id").SharePointGroups().Post(context.Background(), requestBody, nil)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
SharePointGroup sharePointGroup = new SharePointGroup();
sharePointGroup.setOdataType("#microsoft.graph.sharePointGroup");
sharePointGroup.setTitle("Sample Group");
sharePointGroup.setDescription("This is a sample description");
SharePointGroup result = graphClient.storage().fileStorage().containers().byFileStorageContainerId("{fileStorageContainer-id}").sharePointGroups().post(sharePointGroup);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
const options = {
authProvider,
};
const client = Client.init(options);
const sharePointGroup = {
'@odata.type': '#microsoft.graph.sharePointGroup',
title: 'Sample Group',
description: 'This is a sample description'
};
await client.api('/storage/fileStorage/containers/b!ISJs1WRro0y0EWgkUYcktDa0mE8zSlFEqFzqRn70Zwp1CEtDEBZgQICPkRbil_5Z/sharePointGroups')
.post(sharePointGroup);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\SharePointGroup;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new SharePointGroup();
$requestBody->setOdataType('#microsoft.graph.sharePointGroup');
$requestBody->setTitle('Sample Group');
$requestBody->setDescription('This is a sample description');
$result = $graphServiceClient->storage()->fileStorage()->containers()->byFileStorageContainerId('fileStorageContainer-id')->sharePointGroups()->post($requestBody)->wait();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.share_point_group import SharePointGroup
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = SharePointGroup(
odata_type = "#microsoft.graph.sharePointGroup",
title = "Sample Group",
description = "This is a sample description",
)
result = await graph_client.storage.file_storage.containers.by_file_storage_container_id('fileStorageContainer-id').share_point_groups.post(request_body)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
Response
The following example shows the response. The group is successfully created with a newly assigned ID that acts as an identifier.
Note: The response object shown here might be shortened for readability.
HTTP/1.1 201 Created
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.sharePointGroup",
"id" : "ZGYwZTEzYTgtOTExOS00MjdmLWEzNjktOTdjOWM3YjNlYjcyXzE0",
"title": "Sample Group",
"description": "This is sample description",
"principalId": "4"
}