Skip to content

New command: 🔐 spo file roleassignment remove #3693

@Adam-it

Description

@Adam-it

Usage

m365 spo file roleassignment remove [options]

Description

removes a role assignment from file.

Options

Option Description
-u, --webUrl <webUrl> URL of the site where the file is located
--fileUrl [fileUrl] The server-relative URL of the file from which role assignment will be removed. Specify either fileUrl or fileId but not both.
-i, --fileId [fileId] The UniqueId (GUID) of the file from which role assignment will be removed. Specify either fileUrl or fileId but not both.
--principalId [principalId] The SharePoint Id of the principal. It may be either a user id or group id to remove a role assignment for. Specify either upn, groupName or principalId.
--upn [upn] upn/email of user to assign role to. Specify either upn, groupName or principalId.
--groupName [groupName] The group name of Azure AD or SharePoint group. Specify either upn, groupName or principalId.
--confirm [confirm] Don't prompt for confirming removing the roleassignment.

Examples

remove roleassignment from file based on group name

m365 spo file roleassignment remove --webUrl "https://contoso.sharepoint.com/sites/contoso-sales" --fileId "b2307a39-e878-458b-bc90-03bc578531d6"  --groupName "saleGroup"

remove roleassignment from file based on principal Id

m365 spo file roleassignment remove --webUrl "https://contoso.sharepoint.com/sites/contoso-sales" --fileId "b2307a39-e878-458b-bc90-03bc578531d6"  --principalId 2

remove roleassignment from file based on principal Id

m365 spo file roleassignment remove --webUrl "https://contoso.sharepoint.com/sites/contoso-sales"--fileUrl "/sites/project-x/documents/Test1.docx" --principalId 2

Additional Info

a very similar command was already developed but on listitem level (which is actually the same as file) 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/listitem/listitem-roleassignment-remove/

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions