How to Disable Versioning in Document Library in Sharepoint online Powershell?
Hello SharePointers,
Below is the powershell code to disable verisoning in all Document Libraries in a Web in SharePoint online.
$context=New-Object Microsoft.SharePoint.Client.ClientContext($url)
$context.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $password)
$context.Load($context.Web.Lists)
$context.Load($context.Web)
$context.Load($context.Web.Webs)
$context.ExecuteQuery()
Write-Host $ctx.Url -BackgroundColor White -ForegroundColor DarkGreen
foreach( $list in $context.Web.Lists)
{
if ($list.BaseType -eq “DocumentLibrary”) {
$list.EnableVersioning = $false
$list.Update()
}
Happy Sharepointing 🙂