0

I have a document library with many users, some have full access, some have limited access and some have other combinations.Note, The library has a lot of subfolders with unique permission.

I want the entire document library to become read only, Whts the easiest way to do this pls ?

thanks

0

You can remove the unique permissions (folder and item level) in this document library using PowerShell. Then you can break inheritance on library level and give it View Only or Read permission to everyone.

Here is a sample script for your references:

Add-PSSnapin microsoft.sharepoint.powershell -ErrorAction SilentlyContinue
 
#Variables for Web URL, List Name
$WebURL = "<SiteURL>"
$ListName = "<ListName>"
 
#get the list object
$List = (Get-SPweb $WebURL).lists.TryGetList($ListName)
 
#Reset Folder level inheritance
foreach ($folder in $list.Folders) { 
    if ($folder.HasUniqueRoleAssignments){
        Write-Host "Resetting Folder inheritance at:" $folder.Url -fore Yellow
        $folder.ResetRoleInheritance() 
        $folder.Update()
    }
}

#Remove unique permissions on List Items
$ListItems = (Get-SPweb $WebURL).lists.TryGetList($ListName).Items | Where {$_.HasUniqueRoleAssignments}
Foreach($ListItem in $ListItems){
    $ListItem.ResetRoleInheritance()
    Write-host "Broken Inheritance Reset on List Item:" $ListItem.URL -fore Yellow
}

Write-host "Reset Inheritance completed." -fore Green

Reference: Delete Unique Permissions (Reset Broken Inheritance) in SharePoint 2013 using PowerShell.

Another reference on how to set the library to Read Only using PowerShell: How to Make a SharePoint List or Library to Read Only Mode using PowerShell?

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.