cli-microsoft365 icon indicating copy to clipboard operation
cli-microsoft365 copied to clipboard

New command: 🔐 spo list roleassignment remove

Open Adam-it opened this issue 3 years ago • 5 comments

Usage

m365 spo list roleassignment remove [options]

Description

remove a role assignment from list permissions

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 but not multiple.
-t, --listTitle [listTitle] Title of the list. Specify either listId, listTitle or listUrl but not multiple.
--listUrl [listUrl] Relative URL of the list. Specify either listId, listTitle or listUrl but not multiple.
--principalId [principalId] SharePoint ID of principal it may be either user id or group id we want to remove permissions Specify principalId only when upn or groupName are not used.
--upn [upn] upn/email of user. Specify either upn or princpialId
--groupName [groupName] enter group name of Azure AD or SharePoint group. Specify either groupName or princpialId

Examples

remove roleassignment from list by title based on group name

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

remove roleassignment from list by title based on principal Id

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

remove roleassignment from list by url based on principal Id

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

Additional Info

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

Adam-it avatar Jul 29 '22 22:07 Adam-it

putting this on hold before we agree on some on the approach here https://github.com/pnp/cli-microsoft365/issues/3540

Adam-it avatar Jul 31 '22 21:07 Adam-it

@pnp/cli-for-microsoft-365-maintainers any additional comment here ? if it is ok I may take this one.

Adam-it avatar Aug 06 '22 21:08 Adam-it

@martinlingstuyl any comment here ? I think this could be also more or less be started right? Then the same on web and listitem will be very similar so when this will be done and pushed we could mark the other one as 'good first issue'

Adam-it avatar Aug 07 '22 07:08 Adam-it

It looks fine! I'd say: let's open it up!

martinlingstuyl avatar Aug 07 '22 08:08 martinlingstuyl

Ok taking this one as well

Adam-it avatar Aug 07 '22 18:08 Adam-it