Skip to content

New command: 🔐 spo listitem roleassignment remove #3543

@Adam-it

Description

@Adam-it

Usage

m365 spo listitem roleassignment remove [options]

Description

removes a role assignment to a listitem.

Options

Option Description
-u, --webUrl <webUrl> URL of the site where the list is located
-i, --listId [listId] ID of the list. Specify either listId, listTitle or listUrl.
-t, --listTitle [listTitle] Title of the list. Specify either listId, listTitle or listUrl.
--listUrl [listUrl] Relative URL of the list. Specify either listId, listTitle or listUrl.
--listItemId <listItemId> Id of the listitem to remove the role from.
--principalId [principalId] The SharePoint Id of the principal. It may be either a user id or group id to add 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 list item in list by title based on group name

m365 spo listitem roleassignment remove --webUrl "https://contoso.sharepoint.com/sites/contoso-sales" --listTitle "someList" --listItemId 1 --groupName "saleGroup"

remove roleassignment from list item in list by title based on principal Id

m365 spo listitem roleassignment remove --webUrl "https://contoso.sharepoint.com/sites/contoso-sales" --listTitle "Events" --listItemId 1 --principalId 2

remove roleassignment from list item in list by url based on principal Id

m365 spo listitem roleassignment remove --webUrl "https://contoso.sharepoint.com/sites/contoso-sales" --listUrl '/sites/contoso-sales/lists/Events' --listItemId 1 --principalId 2

Additional Info

we may use this POST endpoint
/_api/web/lists/getbytitle("SomeList")/items("SomeId")/roleassignments/removeroleassignment(principalid='{SomeGroupOrUserIDHere}')

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions