Forum Discussion

luvsql's avatar
luvsql
Iron Contributor
Sep 16, 2019
Solved

Modify Permissions on Existing Files and Folder

We used the SharePoint migration tool to migrate 250Gb of data.  These files are within 25 folder then subfolders. The permissions on each folder was updated using the migration tool which is great. ...
  • Andrew Hodges's avatar
    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. 

     

     

Resources