We can make “Site Collection” Read-Only in three ways
1. Central Administration by Administrator
2. PowerShell by Administrator
3. Server Object Model by Developer
Let us explore all the three ways.
Central Administration by Administrator
Go to Central Administration and select Application Management -> Configure quotas and locks”.
The Page will appears, choose the site collection and select the option “Read-Only”.
Note: Choose whether you want this to be farm administrator controlled or site collection administrator controlled.
Enter the lock information and click “Ok”
PowerShell by Administrator
Now we try using PowerShell. Open SharePoint Management Shell. Enter following command for lock the Site Collection by Site URL
Set-SPSite -Identity "<SiteCollection>" -LockState "<State>"
Set-SPSite –Identity “http://c4968397007”–LockState “ReadOnly”
We have to unlock the site collection, enter following command for unlock the Site Collection by Site URL
Set-SPSite –Identity “http://c4968397007”–LockState “Unlock”
Server Object Model by Developer
Crete new console application-> add reference to the Microsoft. SharePoint assembly and execute the following code.
SPSite site = new SPSite(“http://c4968397007”);
Site.ReadOnly = true;
Now the site collection is now read-only.
Note: There are three lock Options
1) Read-Only to prevent users from adding, updating, or deleting content.
2) Adding content prevented to prevent users from adding new content.
3) No Access to prevent users from accessing the site collection and its content.