How to make a Site Collection Read-Only in SharePoint 2013

Advertisements
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>"
 Example:
       Set-SPSite –Identity “http://c4968397007”–LockState “ReadOnly”
   

Unlocking

     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.

Reference:


Advertisements
SHARE

lakshmitulasi Jasti

  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment

2 comments:

  1. Thanks so much! Your instructions are very clear and helpful. I've been wondering how to do this for months and thrilled to find out how finally! sharepoint administrator training online

    ReplyDelete
  2. I have an urgent question. Whenever I am doing read only using powershell, it does it but it's always farm admin controlled. I want site collection admin controlled read only by running through powershell. How to do it?

    ReplyDelete