I want to make SharePoint on-premise and SharePoint online site collection to Readonly. For SharePoint online i can able to achieve with Pnp commands.But on-premise is not working.
code i have used for SharePoint online :
Connect-PnPOnline -url $site -Credentials $credentials Set-PnPSite -Identity $site -LockState ReadOnly
How we can set on-premise site to readonly. I have tried like this , this also giving error.
$site = $clientContext.Site $clientContext.Load($site ) $clientContext.ExecuteQuery() $site.ReadOnly =$true # got an error ReadOnnly property is readonly.