2

Is there anyway to make the Office 365 Site Collection as Read-only mode?

Please help me by providing your valuable reply.

2

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.

  • This is not a good approach because, if for some reason we want to revert the users back to their original groups then we should know which user belongs to which group. Is there any way like site policy to apply in Modern Team Sites??? – Mihir Dec 12 '18 at 11:11
3

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.

enter image description here

Source: How to change the lock state via CSOM

  • This will not make it READ ONLY. It will basically block all access. – Amal Hashim May 5 '15 at 13:39
  • yes, that is what i mention in the anwser that, you have only two values Noaccess and Unlock.... – Waqas Sarwar MVP May 5 '15 at 13:41
2

To set a SharePoint online site into read only mode use the site policy feature. Create a policy with the configuration showed: enter image description here

Switch to site closure and deletion option within the site settings and close the site with the read only policy

enter image description here

You should see a warning text panel at the top of the site

0

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." Read-Only for SPO

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.