How to set SharePoint Online Site to Read Only Mode

Loading

SharePoint Online provides powerful features for managing site collections, including the ability to set sites to read-only mode. Whether it’s for maintenance, data migration, or compliance reasons, activating read-only mode guarantees user access to content while preventing any modifications. In this article, we’ll delve into the process of accomplishing this task.

Set SharePoint Site to read-only mode using PowerShell

As a SharePoint Online administrator, you can control site access by changing the lock state of a site collection. The Set-SPOSite cmdlet allows you to modify various properties, including the lock state.

The Lock state parameter can have the following values :

ReadOnly

– View-only state; no changes allowed. When a site is set to read-only, users can view content but cannot add, update, or delete anything.

#Connect to SharePoint Online
Connect-SPOService -Url https://<tenant>-admin.sharepoint.com

#To set lockstate to readonly mode
Set-SPOSite -Identity "<SiteURL>" -LockState "ReadOnly"

A notification will be displayed on the site indicating that it is in a read-only state(as shown below).

No Access

Blocks user access to the site and its content. If the “NoAccessRedirectUrl” parameter is configured within the Set-SPOTenant cmdlet, any traffic directed towards sites with a “NoAccess” lock state will be rerouted to the specified URL. Conversely, if the “NoAccessRedirectUrl” parameter is not configured, a 403 error will be generated.

#This URL is configured at the Tenant level, directing any SharePoint Online (SPO) site or OneDrive for Business (ODFB) site marked as "NoAccess" to redirect to the specified URL.
Set-SPOTenant -NoAccessRedirectUrl "<URL>"

Unlock

– Unlocks the site, making it available to users.

(Visited 30 times, 1 visits today)

By C A Thomas

Chinchu A. Thomas is an Infrastructure Analyst specializing in Microsoft Azure, the Microsoft 365 suite, AWS, and Windows infrastructure management products.