A common need I see is to be able to have a Document Library in SharePoint Online be changed so that all the permissions throughout inherit from the parent as they would have by default typically. This ‘re-inheritance’ can be done manually, but once you start having a few unique permissions is a deep structure, doing so can be challenging and time consuming.
Unique permissions look like the example above, where you can see the standard banner that appears at the top of the page.
The answer to ‘re-inheriting’ permissions in bulk is to use PowerShell. I have created a script to do exactly this, which you can find here:
https://github.com/directorcia/Office365/blob/master/spo-doclib-reset.ps1
Before you run this script, you’ll need to connect to the Document Library you want to change using PnP.PowerShell. Luckily, I also have a script for that here:
https://github.com/directorcia/Office365/blob/master/o365-connect-pnp.ps1
As I mentioned in a recent article, you’ll need to run all of these scripts typically with PowerShell V7.
The connection script will allow you to select your SharePoint site as shown above.
The connection process will then do a web code login to the selected Document Library as shown above.
After the connection script has completed you should the run the reset script. When you do you’ll see a window showing you all the items you can select to reset. Pick the one you want to continue.
The reset script will then loop through all the items it can find and set their permission back to inheritance.
If the original SharePoint location is refreshed, you’ll see that all items now inherit as expected, as shown above.
This should make getting back to a know starting point with permissions in a SharePoint Online Document Libraries much easier. However, with any permission changes you need to take care and understand the ramifications of what you are doing and the impact they will have. Remember, this script resets ALL permissions for ALL items back to inheriting.
I have tested as best as I can, but if you find any issue please let me know and remember to run this in PowerShell V7!