What is versioning in SharePoint Online?
Version history feature in SharePoint Online tracks every change to the document and creates a copy of it when someone changes a document. Each version of the document has the following:
How to Enable Version History in SharePoint Online Document Library?
To Enable or Disable Versioning in SharePoint Online Document Library:
SharePoint Online: PowerShell to enable versioning in document library
To Enable version history on all lists and libraries, use:
SharePoint Online: Enable Versioning on All List and Libraries using PowerShell
Version history feature in SharePoint Online tracks every change to the document and creates a copy of it when someone changes a document. Each version of the document has the following:
- Version No
- When the version was created
- Who made the version (change)
- Size of the version
How to Enable Version History in SharePoint Online Document Library?
To Enable or Disable Versioning in SharePoint Online Document Library:
- Navigate to your document library >> Click on Settings gear >> and then "Library Settings" Menu item.
- Under Library settings page, Click on "Versioning Settings"
- Select "Create major versions" option and enter number of versions to track (by default, this is enabled with 500 versions in SharePoint Online).
- Scroll to the bottom of the page. Click "OK" to apply versioning setting changes.
SharePoint Online: PowerShell to enable versioning in document library
#Load SharePoint CSOM Assemblies
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
Function Enable-DocLibraryVersioning()
{
param
(
[Parameter(Mandatory=$true)] [string] $SiteURL,
[Parameter(Mandatory=$true)] [string] $DocLibraryName
)
Try {
#Setup Credentials to connect
$Cred = Get-Credential
$Cred = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.UserName,$Cred.Password)
#Get the Library from the web
$Library = $Ctx.Web.Lists.GetByTitle($DocLibraryName)
#enable versioning in sharepoint online
$Library.EnableVersioning = $True
$Library.MajorVersionLimit = 50
$Library.update()
$Ctx.ExecuteQuery()
write-host -f Green "Version History Enabled for Document Library!"
}
Catch {
write-host -f Red "Error enabling versioning in Document Library!" $_.Exception.Message
}
}
#Set Parameters
$SiteURL= "https://crescent.sharepoint.com/"
$DocLibraryName="Project Docs"
#Call the function to enable versioning in document library
Enable-DocLibraryVersioning -siteURL $SiteURL -DocLibraryName $DocLibraryName
To Enable version history on all lists and libraries, use:
SharePoint Online: Enable Versioning on All List and Libraries using PowerShell