Forum Discussion
How to remove all list item permissions using PnP Powershell
- Jan 20, 2021
It's normal behavior for the current user to remain in the list item permissions when the inheritance is broken and cleared on a list item to ensure that at least one user still has access.
Try this:
First assign permissions to a user:
Set-PnPListItemPermission -List 'ListName' -Identity 1 -User 'user@contoso.com' -AddRole 'Contribute' -ClearExistingThen remove permissions of the user running script:
Set-PnPListItemPermission -List 'ListName' -Identity 1 -User "scriptuser@contoso.com" -RemoveRole "Full Control"Reference: Set-PnPListItemPermission -ClearExisting adds the user running the script with full control
Please click Mark as Best Response if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
It's normal behavior for the current user to remain in the list item permissions when the inheritance is broken and cleared on a list item to ensure that at least one user still has access.
Try this:
First assign permissions to a user:
Set-PnPListItemPermission -List 'ListName' -Identity 1 -User 'user@contoso.com' -AddRole 'Contribute' -ClearExisting
Then remove permissions of the user running script:
Set-PnPListItemPermission -List 'ListName' -Identity 1 -User "scriptuser@contoso.com" -RemoveRole "Full Control"
Reference: Set-PnPListItemPermission -ClearExisting adds the user running the script with full control
Please click Mark as Best Response if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
ganeshsanap Thanks for your help.