Usage
m365 spo folder roleassignment add [options]
Description
Adds a role assignment to the specified folder.
Options
| Option |
Description |
-u, --webUrl <webUrl> |
The URL of the site where the file is located |
-f, --folderUrl <folderUrl> |
The server- or site-relative URL of the folder. |
--principalId [principalId] |
The SharePoint principal id. It may be either an user id or group id for which the role assignment will be removed. Specify either upn, groupName or principalId but not multiple. |
--upn [upn] |
The upn/email of the user. Specify either upn, groupName or principalId but not multiple. |
--groupName [groupName] |
The Azure AD or SharePoint group name. Specify either upn, groupName or principalId but not multiple. |
--roleDefinitionId [roleDefinitionId] |
ID of the role definition. Specify either roleDefinitionId or roleDefinitionName but not both. |
--roleDefinitionName [roleDefinitionName] |
The name of the role definition. E.g. 'Contribute', 'Read'. Specify either roleDefinitionId or roleDefinitionName but not both |
Examples
Add the role assignment to the specified folder based on the group name.
m365 spo folder roleassignment add --webUrl "https://contoso.sharepoint.com/sites/contoso-sales" --folderUrl "/Shared Documents" --groupName "saleGroup"
Add the role assignment to the specified folder based on the principal Id.
m365 spo folder roleassignment add --webUrl "https://contoso.sharepoint.com/sites/contoso-sales" --folderUrl "/Shared Documents" --principalId 2
Additional Info
a very similar command was already developed but on list level, so we may probably use that command code as reference to make it easier to create this one
https://pnp.github.io/cli-microsoft365/cmd/spo/list/list-roleassignment-add/
Usage
m365 spo folder roleassignment add [options]
Description
Adds a role assignment to the specified folder.
Options
-u, --webUrl <webUrl>-f, --folderUrl <folderUrl>--principalId [principalId]upn,groupNameorprincipalIdbut not multiple.--upn [upn]upn,groupNameorprincipalIdbut not multiple.--groupName [groupName]upn,groupNameorprincipalIdbut not multiple.--roleDefinitionId [roleDefinitionId]roleDefinitionIdorroleDefinitionNamebut not both.--roleDefinitionName [roleDefinitionName]roleDefinitionIdorroleDefinitionNamebut not bothExamples
Add the role assignment to the specified folder based on the group name.
Add the role assignment to the specified folder based on the principal Id.
Additional Info
a very similar command was already developed but on list level, so we may probably use that command code as reference to make it easier to create this one
https://pnp.github.io/cli-microsoft365/cmd/spo/list/list-roleassignment-add/