In this post we will discuss how to make a site collection readonly in SharePoint.
Also you can check out:
To make a site collection read only means we are preventing users from adding, updating, or deleting content in the site collection.
You can also make a site collection as Adding content prevented, which means to prevent users from adding new content, also we can make site collection as "No Access" which means to prevent users from accessing the site collection and its content.
We can make a site collection read only by using SharePoint Central Administration, By using PowerShell and by using Server side object model.
SharePoint Central Administration:
Open SharePoint central Administration, then select Application Management.
From the Application Management screen click on Configure quotas and locks from Site Collection section.
This will open the Site Collection Quotas and Locks screen, Select the Read-Only radio button under the Lock status for this site: section. And then click on OK.
First open SharePoint Management Shell, make sure you are opening in Administrator mode.
Set-SPSite -Identity "<SiteCollection>" -LockState "<State>"
Set-SPSite -Identity "http://SiteCollectionURL" -LockState "ReadOnly"
Below is the object model code to make site collection readonly:
SPSite site = new SPSite("http://SiteCollectionURL");
site.ReadOnly = true;