This post provides a quick and dirty way to bulk restore permissions inheritance to files/ folders in SharePoint sites, without needing to use PowerShell or any other scripting capabilities.

The problem
Broken permissions inheritance and document libraries in SharePoint go hand in hand and I’m sure that anyone that manages SharePoint environments will know it is a real pain to try to restore en masse. Generally speaking files/ folders have permissions inheritance broken when users:
- Share files directly with colleagues
- Break inheritance on folders
- Grant permissions to external users
- Migrate content from legacy systems
In SharePoint you can restore inheritance manually, but it has to be done one item at a time. Recently, I needed to restore inheritance on dozens of files and folders within a library. I tried to use PowerShell/ PnP, but couldn’t get it working and didn’t want to mess around with setting up app registrations to work with the newer version of PowerShell, so the below is a workaround using only the browser for if you are lazy like me!
The workaround
This approach uses a Permissions Exceptions page to identify items with broken inheritance. This is a hidden page: /_layouts/15/uniqperm.aspx which isnt readily available from the advanced permissions area on SharePoint. From this page, you will need to compile a list of the items you want to fix, then use your browser’s Developer Tools to run a simple JavaScript script directly against the SharePoint site. The script automates the task of opening each file or folder individually and selecting Delete Unique Permissions. The browser executes commands for every item in your list, restoring permission inheritance in bulk.
Note: The script only works with what’s visible within the Permissions Exceptions page. so the list of items you want to restore permissions for will need to be replaced in batches as you iterate through the process, as SharePoint only displays 50 items at one time.
Step 1: Open the Permissions Exceptions Page
This page actually took me ages to find, I won’t go into detail into how I found it, but follow these steps to get to it:
- Navigate to your site > cog > site permissions > advanced site permissions
- In the yellow banner at the top of the page > select show these items

- Press Manage Permissions on one of the top-level locations where you have items with broken inheritance (i.e. Documents)
- The URL in your browser will now have the GUID of your library/ list. From here you need to replace
user.aspxwithuniqueperm.aspx - The URL should look something like this:

Step 2: Create list of items to restore permissions
- From the permissions exceptions page:
- Review the items.
- Copy the names of the files and folders you want to restore.
- Add them to the script.
Note: I did this by highlighting all the items from the permissions exception page and pasting them into notepad. I then just took the file names and added them to the script.
const fileNames = [ "Document.docx", "Sync test", "TestExternalUpload"];
Step 3: Open Developer Tools
- In Edge or Chrome, press F12 (or select developer tools from the settings menu)
- Select the console tab > paste in the code below (remember to add your file names to this code)
(async function resetInheritanceViaTitleBatch2() { const libraryName = "Documents"; const siteUrl = _spPageContextInfo.webAbsoluteUrl; const digest = document.getElementById("__REQUESTDIGEST")?.value || _spPageContextInfo.formDigestValue; const fileNames = [ "Document.docx", "Sync test", "TestExternalUpload" ]; console.log(`Starting inheritance reset for new batch of ${fileNames.length} items...`); let restoredCount = 0; for (const fileName of fileNames) { const searchQuery = `${siteUrl}/_api/search/query?querytext='filename:"${encodeURIComponent(fileName)}"'&selectproperties='ListItemId,Title,Path'`; try { const searchResp = await fetch(searchQuery, { headers: { "Accept": "application/json;odata=nometadata" } }); const searchData = await searchResp.json(); const results = searchData.PrimaryQueryResult?.RelevantResults?.Table?.Rows || []; if (results.length > 0) { const row = results[0].Cells; const itemId = row.find(c => c.Key === "ListItemId")?.Value; if (itemId) { const resetUrl = `${siteUrl}/_api/web/lists/getByTitle('${libraryName}')/items(${itemId})/resetroleinheritance`; const resetResp = await fetch(resetUrl, { method: "POST", headers: { "Accept": "application/json;odata=nometadata", "X-RequestDigest": digest } }); if (resetResp.ok) { console.log(`%cRestored inheritance: ${fileName}`, "color: green"); restoredCount++; } else { console.log(`%cFailed to reset: ${fileName} (HTTP ${resetResp.status})`, "color: red"); } } } else { console.log(`%cFile not indexed/found via Search: ${fileName}`, "color: orange"); } } catch (err) { console.error(`Error processing ${fileName}:`, err); } } console.log(`%cProcess complete! Restored parent inheritance on ${restoredCount} items. Refreshing page...`, "color: cyan; font-weight: bold;"); setTimeout(() => location.reload(), 2000);})();
- Once it runs, you should see an output similar to the below. Any failures/ errors will be highlighted in red, I just run the script again and it usually works – otherwise I just manually fix what’s left over.

Note: In Chrome, you will receive a warning as per the below. Just enter “allow pasting” and press enter then paste your script again.

Things to watch out for
- The permissions exception page only shows the first 50 items with broken permissions inheritance. If you have more than that, you will need to repeat the steps, updating the file/ folder names in the script.
- Sometimes the script will fail with a “403 forbidden” error. I just refresh the page and run again and it usually works.
- You’ll need to be a site owner/ admin or SharePoint admin to run the script.
The hidden /_layouts/15/uniqperm.aspx page remains one of the quickest ways to identify permission exceptions within a SharePoint library. Combined with a simple browser console script, it provides a fast and effective method for cleaning up unique permissions without resorting to PowerShell or manually updating each item. For administrators inheriting older SharePoint environments where ad-hoc sharing has been common, this approach can save hours of repetitive effort and help bring permissions back under control.



Leave a Reply