There are many different business scenarios when we want to set a SharePoint site collection as read-only mode (as shown in above screenshot) to prevent any further addition/modification of content but simultaneously to make the existing content available to the users.
Using SharePoint Online Management Shell
Set-SPOSite -Identity “<SiteURL>” -LockState “ReadOnly”
Read more about other lock statuses here
Using PnP PowerShell
Connect-PnPOnline -Url “<SiteURL>” -Interactive
Set-PnPSite -LockState ReadOnly
Read more about Set-PnPSite command.
Try:
set-SPSite – Identity “url_to_site” -LockState “ReadOnly”
-LockState
Sets the lock state of this site collection. The valid lock states are
Unlock Unlocks the site collection and makes it available to users
NoAdditions Prevents users from adding new content to the site collection. Updates and deletions are still allowed
ReadOnly Prevents users from adding, updating, or deleting content.
NoAccess Prevents access to content completely. Users who attempt to access the site receive an access-denied message.
https://docs.microsoft.com/en-us/powershell/module/sharepoint-server/set-spsite?view=sharepoint-ps#examples
I just noticed now, you are talking about SPO, you can delete this coment
I like the helpful info you provide for your articles. I will bookmark your blog
and test once more here regularly. I’m rather certain I’ll learn a lot of new stuff right here!
Good luck for the following!