Office 365 Read-only mode
-
03-10-2020 - |
Pregunta
Is there anyway to make the Office 365 Site Collection as Read-only
mode?
Please help me by providing your valuable reply.
Solución
I think this is not supported in SharePoint Online (http://community.office365.com/en-us/f/154/t/223877.aspx).
I would suggest you remove the permission of users by adding them into Reader Groups.
Or temporarily change group permission to Read Only.
Otros consejos
you can lock a site using the Powershell or CSOM approach. Their is one command(Set-SPOSite) in SharePoint Online which set the lockstatus to the site collection.
Sets the lock state on a site. Valid values are: NoAccess and Unlock. When the lock state of a site is NoAccess, all traffic to the site will be blocked. If parameter NoAccessRedirectUrl in the Set-SPOTenant cmdlet is set, traffic to sites that have a lock state NoAccess will be redirected to that URL. If parameter NoAccessRedirectUrl is not set, a 403 error will be returned.
PowerShell:
Set-SPOSite https://[tenant].sharepoint.com/sites/targetsite -LockState [NoAccess|Unlock]
CSOM To do this in CSOM, you can utilize the TenantAdministration API; however, this is only available in the v16 SharePoint Online API.
using (var clientContext = new ClientContext(tenantUrl)) {
clientContext.Credentials = spoCredentials;
var tenant = new Tenant(clientContext);
var siteProperties = tenant.GetSitePropertiesByUrl(siteUrl, true);
clientContext.Load(siteProperties);
clientContext.ExecuteQuery();
Console.WriteLine("LockState: {0}", siteProperties.LockState);
siteProperties.LockState = "Unlock";
siteProperties.Update();
clientContext.ExecuteQuery();
}
When the site is locked, you'll see it in the admin site with a lock icon next to it as seen below.
Seems like MS implemented "ReadOnly" option for SPO.
Although it is not documented yet.
But I just was able to do powershell
"Set-SPOSite $site -LockState Readonly
".
And get
PS C:\Users\Vlad> $site | select Title, Status, LockState | fl
Title : test01
Status : Active
LockState : ReadOnly
and well-known red "This site is read only at the farm administrator's request."
I can confirm that Vladilen's answer works with SharePoint online now, and with the SharePoint portion attached to an O365 group (file store as well as site).
I would have replied to his answer but I just created this account and don't have a high enough reputation yet to comment or upvote.