Is it possible to disallow a SharePoint site collection to be not accessible for all users?
As a short answer: YES, you can prevent access to a specific site collection in SharePoint 2016 by managing the Site Collection Quotas and Locks in SharePoint Central Administration.
How to prevent access for a site collection in SharePoint Server?
To prevent users to can browse or accessing a specific site collection in SharePoint 2016, you have to configure the Site Collection Quotas and Locks in Central Administration by doing the following:
- Open SharePoint Central Administrator > Application Management > Site Collection > Configure quotas and locks.
- In Site Collection Quotas and Locks, Choose the site collection that you would like to prevent all users to access,
- At Site Lock Information, you have 4 options to manage the lock status for the specified site collection as following:
- Not locked to unlock the site collection and make it available to users.
- Adding content prevented to prevent users from adding new content to the site collection. however, updates and deletions are still allowed.
- Read-only (blocks additions, updates, and deletions) to prevent users from adding, updating, or deleting content.
- No access to prevent users from accessing the site collection and its content.
Note: You must be a member of the Site collection Administrator for this site collection to can manage Quotes and Locks.
In your case, you have to just set the lock status to "NO ACCESS" to prevent users from accessing the site collection and its content, and in this case, the site collection will not be available with no need of deleting the site collection. however, the users who attempt to access this site receive an error message and you have to Handel it in your F5 settings.
How to lock a site collection in SharePoint using PowerShell?
You can also use the PowerShell to set the lock status to "NOACCESS" by running the below PowerShell Command-Line:
Set-SPSite -Identity http://SiteCollectionURL/ -LockState NoAccess
If you would like to allow the site collection again for all privileged users, you can run the below PowerShell Command-Line:
Set-SPSite -Identity http://SiteCollectionURL/ -LockState Unlock
If you would like to prevent users from adding new content however the update and delete would be still allowed, you can run the below PowerShell Command-Line:
Set-SPSite -Identity http://SiteCollectionURL/ -LockState NoAdditions
Finally, If you would like to prevent users from adding new content, updating, and deleting, you can run the below PowerShell Command-Line:
Set-SPSite -Identity http://SiteCollectionURL/ -LockState ReadOnly
Applied To
- SharePoint 2019
- SharePoint 2016
- SharePoint 2013
Check also how to Manage the lock status for site collections in SharePoint Server