Forum Discussion
Modify Permissions on Existing Files and Folder
- Sep 16, 2019
luvsql only way I found to do this was to run a powershell script. However this took forever and I was not sure if it has actually worked. Here is the script using pnp: -
$Log = 0 $items = Get-PnPListItem -List Companies -PageSize 1000 | where {$_.HasUniqueRoleAssignments} foreach($item in $items) { try { $Log = $Log + 1 $_.ResetRoleInheritance() Write-Host $log } catch { Write-Host “error” } }I broke it into chunks of 1000 items as returning the list of files was taking too long.
I have not run that in a while so no guarantees it will work. The other thing you may try is reapply the permissions to the library but tick the box " Share everything in this folder, even items with unique permissions." Sometimes that works sometimes it says you are over the list threshold.
luvsql only way I found to do this was to run a powershell script. However this took forever and I was not sure if it has actually worked. Here is the script using pnp: -
$Log = 0
$items = Get-PnPListItem -List Companies -PageSize 1000 | where {$_.HasUniqueRoleAssignments}
foreach($item in $items)
{
try
{
$Log = $Log + 1
$_.ResetRoleInheritance()
Write-Host $log
}
catch
{
Write-Host “error”
}
}
I broke it into chunks of 1000 items as returning the list of files was taking too long.
I have not run that in a while so no guarantees it will work. The other thing you may try is reapply the permissions to the library but tick the box " Share everything in this folder, even items with unique permissions." Sometimes that works sometimes it says you are over the list threshold.