Skip to content

Commit 074a7d0

Browse files
author
rkoppolu
committed
Added Documentation Page for Bulk Container Permission Creation via Delta Patch
1 parent 7f704aa commit 074a7d0

3 files changed

Lines changed: 207 additions & 0 deletions

File tree

Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
---
2+
title: "Create permissions in bulk"
3+
description: "Add multiple permissions to an existing fileStorageContainer using delta patch."
4+
author: "rkoppolu"
5+
ms.localizationpriority: medium
6+
ms.subservice: "onedrive"
7+
doc_type: apiPageType
8+
ms.date: 04/22/2026
9+
---
10+
11+
# Create permissions in bulk
12+
13+
Namespace: microsoft.graph
14+
15+
[!INCLUDE [beta-disclaimer](../../includes/beta-disclaimer.md)]
16+
17+
Add up to 10 [permission](../resources/permission.md) objects to an existing [fileStorageContainer](../resources/filestoragecontainer.md) in a single request using delta patch.
18+
19+
> [!NOTE]
20+
> Currently, we only support bulk **creating** permissions. Bulk updating and deleting permissions will be supported in the future.
21+
> [!IMPORTANT]
22+
> Permissions added to a [fileStorageContainer](../resources/filestoragecontainer.md) apply to all its [driveItem](../resources/driveitem.md) objects, regardless of any unique or restrictive permissions applied to those items.
23+
24+
[!INCLUDE [national-cloud-support](../../includes/all-clouds.md)]
25+
26+
## Permissions
27+
28+
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](/graph/permissions-overview#best-practices-for-using-microsoft-graph-permissions). For details about delegated and application permissions, see [Permission types](/graph/permissions-overview#permission-types). To learn more about these permissions, see the [permissions reference](/graph/permissions-reference).
29+
30+
<!-- { "blockType": "permissions", "name": "filestoragecontainer_deltapatch_permissions" } -->
31+
[!INCLUDE [permissions-table](../includes/permissions/filestoragecontainer-deltapatch-permissions-permissions.md)]
32+
33+
[!INCLUDE [app-permissions](../includes/sharepoint-embedded-app-permissions.md)]
34+
35+
## HTTP request
36+
37+
<!-- {
38+
"blockType": "ignored"
39+
}
40+
-->
41+
```HTTP
42+
PATCH /storage/fileStorage/containers/{containerId}/permissions
43+
```
44+
45+
## Request headers
46+
47+
|Name|Description|
48+
|:---|:---|
49+
|Authorization|Bearer {token}. Required. Learn more about [authentication and authorization](/graph/auth/auth-concepts).|
50+
|Content-Type|application/json. Required.|
51+
52+
## Request body
53+
54+
In the request body, supply a JSON object with the following properties.
55+
56+
|Name|Type|Description|
57+
|:---|:---|:---|
58+
|@context|String|Must be set to `#$delta` to signal a delta patch operation. Required.|
59+
|value|[permission](../resources/permission.md) collection|A collection of up to 10 permission objects to create. Required.|
60+
61+
Each [permission](../resources/permission.md) object in the **value** collection supports the following properties.
62+
63+
|Name|Type|Description|
64+
|:---|:---|:---|
65+
|roles|Collection(String)|The type of permission to grant. The possible values are: `reader`, `writer`, `manager`, `owner`.|
66+
|grantedToV2|[sharePointIdentitySet](../resources/sharepointidentityset.md)|For user type permissions, the details of the user for this permission.|
67+
68+
## Response
69+
70+
If successful, this method returns a `200 OK` response code and a collection of [permission](../resources/permission.md) objects in the response body. Successfully created permissions include the permission object. Failed items include a `@Core.DataModificationException` annotation with error details.
71+
72+
## Examples
73+
74+
### Request
75+
76+
The following example shows how to add three permissions to a container in a single request.
77+
78+
<!-- {
79+
"blockType": "request",
80+
"name": "create_permissions_bulk"
81+
}
82+
-->
83+
```http
84+
PATCH https://graph.microsoft.com/beta/storage/fileStorage/containers/b!ISJs1WRro0y0EWgkUYcktDa0mE8zSlFEqFzqRn70Zwp1CEtDEBZgQICPkRbil_5Z/permissions
85+
Content-Type: application/json
86+
87+
{
88+
"@context": "#$delta",
89+
"value": [
90+
{
91+
"roles": ["reader"],
92+
"grantedToV2": {
93+
"user": {
94+
"userPrincipalName": "jacob@contoso.com"
95+
}
96+
}
97+
},
98+
{
99+
"roles": ["manager"],
100+
"grantedToV2": {
101+
"user": {
102+
"userPrincipalName": "alex@contoso.com"
103+
}
104+
}
105+
},
106+
{
107+
"roles": ["writer"],
108+
"grantedToV2": {
109+
"user": {
110+
"userPrincipalName": "kate@contoso.com"
111+
}
112+
}
113+
}
114+
]
115+
}
116+
```
117+
118+
### Response
119+
120+
The following example shows the response. The first two permissions were created successfully. The third failed because the user wasn't found, as indicated by the `@Core.DataModificationException` annotation.
121+
122+
>**Note:** The response object shown here might be shortened for readability.
123+
124+
<!-- {
125+
"blockType": "response",
126+
"truncated": true,
127+
"@odata.type": "Collection(microsoft.graph.permission)"
128+
}
129+
-->
130+
```http
131+
HTTP/1.1 200 OK
132+
Content-Type: application/json
133+
134+
{
135+
"@odata.context": "https://graph.microsoft.com/beta/$metadata#storage/fileStorage/containers('b%21ISJs1WRro0y0EWgkUYcktDa0mE8zSlFEqFzqRn70Zwp1CEtDEBZgQICPkRbil_5Z')/permissions/$delta",
136+
"value": [
137+
{
138+
"id": "X2k6MCMuZnxtZW1iZXJzaGlwfGpha2VzbWl0aEBjb250b3NvLm9ubWljcm9zb2Z0LmNvbQ",
139+
"roles": [
140+
"reader"
141+
],
142+
"grantedToV2": {
143+
"user": {
144+
"displayName": "Jacob Hancock",
145+
"id": "12cf37a9-fd2d-463f-a9c4-5a5acfef22df",
146+
"userPrincipalName": "jacob@contoso.com"
147+
}
148+
}
149+
},
150+
{
151+
"id": "X2k6MCMuZnxtZW1iZXJzaGlwfGpvaG5kb2VAY29udG9zby5vbm1pY3Jvc29mdC5jb20",
152+
"roles": [
153+
"manager"
154+
],
155+
"grantedToV2": {
156+
"user": {
157+
"displayName": "Alex Johnson",
158+
"id": "97fb19fc-f342-48ab-b945-85eb8b81a732",
159+
"userPrincipalName": "alex@contoso.com"
160+
}
161+
}
162+
},
163+
{
164+
"@Core.DataModificationException": {
165+
"@odata.type": "#Org.OData.Core.V1.DataModificationExceptionType",
166+
"failedOperation": "Create",
167+
"responseCode": 400,
168+
"info": {
169+
"code": "BadRequest",
170+
"message": "The specified user kate@contoso.com could not be found."
171+
}
172+
},
173+
"id": "00000000-0000-0000-0000-000000000000",
174+
"roles": [
175+
"writer"
176+
],
177+
"grantedToV2": {
178+
"user": {
179+
"userPrincipalName": "kate@contoso.com"
180+
}
181+
}
182+
}
183+
]
184+
}
185+
```
186+
187+
## Error response codes
188+
189+
|HTTP code|Description|
190+
|:---|:---|
191+
|400|Bad request.|
192+
|401|Request lacks valid authentication credentials.|
193+
|403|Provided authentication credentials are valid but insufficient to perform requested operation. Examples: the calling app does not have permissions to manage permissions for containers of this type; the calling user has no permissions on this container instance or their role does not allow container permission management.|
194+
|404|Container doesn't exist.|
195+
|409|Resource modified. Returned per-item when attempting to add an identity that already has a different role on the container.|
196+
|423|Container is locked. For example, the container is archived.|
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
ms.topic: include
3+
ms.localizationpriority: medium
4+
---
5+
6+
|Permission type|Least privileged permissions|Higher privileged permissions|
7+
|:---|:---|:---|
8+
|Delegated (work or school account)|FileStorageContainer.Selected|FileStorageContainer.Manage.All|
9+
|Delegated (personal Microsoft account)|FileStorageContainer.Selected|Not available.|
10+
|Application|FileStorageContainer.Selected|Not available.|

api-reference/beta/resources/filestoragecontainer.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ Represents a location where multiple users or a group of users can store files a
3131
|[Get drive](../api/filestoragecontainer-get-drive.md)|[drive](../resources/drive.md)|Get the drive resource from a [fileStorageContainer](../resources/filestoragecontainer.md) object.|
3232
|[List permissions](../api/filestoragecontainer-list-permissions.md)|[permission](../resources/permission.md) collection| List permissions on a fileStorageContainer.|
3333
|[Add permissions](../api/filestoragecontainer-post-permissions.md)|[permission](../resources/permission.md)|Add permission to a fileStorageContainer.|
34+
|[Create permissions in bulk](../api/filestoragecontainer-deltapatch-permissions.md)|[permission](../resources/permission.md) collection|Add multiple permissions to a fileStorageContainer using delta patch.|
3435
|[Update permissions](../api/filestoragecontainer-update-permissions.md)|[permission](../resources/permission.md)|Update permission on a fileStorageContainer.|
3536
|[Delete permissions](../api/filestoragecontainer-delete-permissions.md)|None|Delete permission from a fileStorageContainer.|
3637
|[List custom property](../api/filestoragecontainer-list-customproperty.md)|[filestoragecontainercustompropertyvalue](../resources/filestoragecontainercustompropertyvalue.md) collection|List custom properties of the fileStorageContainer.|

0 commit comments

Comments
 (0)