AnswerBun.com

SharePoint 2013 restrict permission to read only

SharePoint Asked by Fjay on September 3, 2020

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

One Answer

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?

Correct answer by Chelsea_MSFT on September 3, 2020

Add your own answers!

Related Questions

Library Search Permissions

1  Asked on December 26, 2020 by joe-fedorowicz

 

Exceeds Threshold

4  Asked on December 25, 2020

     

SPListItemCollection to Dictionary

1  Asked on December 24, 2020 by k-jones

     

Use SharePoint as front end for access

2  Asked on December 22, 2020 by dominica

   

Save Modal Dialog Field Value to Refresh Page DIV

1  Asked on December 22, 2020 by aurumpotabile

   

_x0020_ Not Working in AJAX

1  Asked on December 19, 2020 by bigchungus

       

Edit Hidden Item in List

1  Asked on December 18, 2020 by decave

       

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP