In the library, I have ParentFolder which contains SubFolder. I have broken role inheritance in both ParentFolder and SubFolder (via a web interface).
But when I remove role assignment for the user in ParentFolder with PowerShell script it disappears in Subfolder too. I don't understand why it disappears if I have broken role inheritance. And how to prevent it? How could I delete role assignment for the user in ParentFolder, but save it in a subfolder?
Here is the code:
$web.AllowUnsafeUpdates = $true
$object.RoleAssignments.Remove($user)
$web.AllowUnsafeUpdates = $true
$object.SystemUpdate($true)
I have SharePoint 2016