How to turn on versioning on ALL document libraries for a site?

Summary

The requirement is to turn on versioning for all site document libraries, including subsites. Also, the Major version number should be 500.

The Document Library Versioning Settings for Major Version as 500

The following Set-PnPList command can be used to set the Versioning and Major version as 500 for a Document Library

# 

Set-PnPList -Identity "Documents" -EnableVersioning 1 -MajorVersions 25

The following command can be used to set the Versionins and Major / Minor version numbers.

# In this command the minor version in the UI (as aboove) is the draft version.

Set-PnPList -Identity "Documents" -EnableVersioning $true -MajorVersions 25 -EnableMinorVersions $true -MinorVersions 10

#

There are two files to automate the process of turning on versioning. The input file is site2process.CSV. The input file is with list of Site Collection URLs to process.

Url
https://m365x162783.sharepoint.com/sites/Test1
https://m365x162783.sharepoint.com/sites/Test2

The script file is located here.

Conclusion

Using the above script you can turn on the versioning of all the document libaries.

About Pankaj

I am a Developer and my linked profile is https://www.linkedin.com/in/pankajsurti/
This entry was posted in PnP.PowerShell, SharePoint. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s