Skip to content

spo file roleassignment remove

Removes a role assignment from a file.

Usage

m365 spo file roleassignment remove [options]

Options

-u, --webUrl <webUrl>
URL of the site where the file is located.
--fileUrl [fileUrl]
The server-relative URL of the file. Specify either fileUrl or fileId but not both.
-i, --fileId [fileId]
The UniqueId (GUID) of the file. 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. Specify either upn, groupName, or principalId but not multiple.
--upn [upn]
Upn/email of the user. Specify either upn, groupName, or principalId but not multiple.
--groupName [groupName]
The group name of an Azure AD or SharePoint group. Specify either upn, groupName, or principalId but not multiple.
--confirm [confirm]
Don't prompt for confirmation.
-h, --help [help]
Output usage information. Optionally, specify which section of command's help you want to see. Allowed values are options, examples, remarks, response, full. Default is full.
--query [query]
JMESPath query string. See http://jmespath.org/ for more information and examples
-o, --output [output]
Output type. json,text,csv,md. Default json
--verbose
Runs command with verbose logging
--debug
Runs command with debug logging

Examples

Remove a role assignment by principal id from a file by id

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

Remove a role assignment by upn from a file by url

m365 spo file roleassignment remove --webUrl "https://contoso.sharepoint.com/sites/contoso-sales" --fileUrl "/sites/contoso-sales/documents/Test1.docx" --upn "user1@contoso.onmicrosoft.com"

Remove a role assignment by group name from a file by id

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