How to Disable Versioning in a SharePoint Library Using PnP PowerShell?

One of my team members recently tried to figure out how to disable versioning in a SharePoint library. As there is no option in the UI ( User Interface), it is not possible to do this using the browser. I suggested using PnP PowerShell to disable the SharePoint list and library versioning.

Let’s see how to do it.

Disable Versioning in a SharePoint Library Using PnP PowerShell

If you are new to versioning in SharePoint, here is a quick definition.

Versioning in SharePoint is a feature that allows users to track and manage changes to documents and list items in a SharePoint list or document library. It creates a historical record of changes, including the date/time and the user who made the change.

By default, versioning is enabled in both lists and libraries in SharePoint Online. If you do not want versioning, you can disable it using PowerShell, as there is no option to disable it using the browser. Microsoft removed the disabling option through UI.

You can version settings in a library by following the steps.

  • Open the SharePoint library, click the Settings icon -> Library settings, and then click More library settings.
  • This will open the settings page, and here, click on the “Versioning settings”. This will open the Versioning Settings page, and here you can see there is no option to disable the versioning. Check the screenshot for reference.
Disable Versioning in a SharePoint Library

So, now let me show you how to disable versioning for this SharePoint document library using PnP PowerShell.

If you are new to PnP PowerShell, check this tutorial first to learn how to connect to a SharePoint site using PnP PowerShell.

To disable versioning in a SharePoint document library using PnP PowerShell, you can use the following cmdlet:

# Connect to the SharePoint site
Connect-PnPOnline -Url "https://szg52.sharepoint.com/sites/MarketingTeam/" -UseWebLogin

# Disable versioning for the specific document library
Set-PnPList -Identity "Marketing Documents" -EnableVersioning $false

Here’s a breakdown of the commands:

  1. Connect-PnPOnline: This cmdlet connects to your SharePoint Online site. Replace "https://szg52.sharepoint.com/sites/MarketingTeam/" with the URL of your SharePoint site.
  2. Set-PnPList: This cmdlet modifies the settings of a SharePoint list or library. The -Identity parameter specifies the name of the library, and the -EnableVersioning $false parameter disables versioning for that library.

You can see the message after I executed the above script using VS code.

Disable Versioning in a SharePoint Library Using PnP PowerShell

After this, when you open the Versioning Settings page, you will see the “No versioning” option in the “Document Version History“.

Check the screenshot below.

PowerShell disable Versioning in a SharePoint list or Library

This is how to disable versioning in a SharePoint list or document library using PnP PowerShell.

If you want to check whether versioning is disabled, run the PowerShell script below.

# Connect to the SharePoint site
Connect-PnPOnline -Url "https://szg52.sharepoint.com/sites/MarketingTeam/" -UseWebLogin

$list = Get-PnPList -Identity "Marketing Documents"
$list.EnableVersioning

If it returns false then the versioning is disabled, and you can see the screenshot below:

sharepoint disable versioning powershell

And, if you want to enable the versioning for the document library again, you need to change -EnableVersioning $true, and the full script is like below:

# Connect to the SharePoint site
Connect-PnPOnline -Url "https://szg52.sharepoint.com/sites/MarketingTeam/" -UseWebLogin

# Disable versioning for the specific document library
Set-PnPList -Identity "Marketing Documents" -EnableVersioning $true

Conclusion

As there is no option to disable versioning in a SharePoint list or library’s UI, you have to use PowerShell. In this tutorial, I explained how to disable versioning in a SharePoint list or document library using PnP PowerShell.

If you still have questions, feel free to leave a comment below.

You may also like:

100 PowerShell cmdlets download free

100 POWERSHELL CMDLETS E-BOOK

FREE Download an eBook that contains 100 PowerShell cmdlets with complete script and examples.