Set the major version limit for all the lists and libraries (data loss involved)

A short script that sets the major version limit for all the libraries and lists in the whole site collection or in the whole tenant. It requires SharePoint Online Management Shell and SharePoint SDK installed.

 
 
 
 
 
5 Star
(2)
571 times
Add to favorites
Office 365
3/23/2020
E-mail Twitter del.icio.us Digg Facebook
  • Can you help me modify the script to change major versioning for all OneDrive users only?
    3 Posts | Last post September 17, 2019
    • Hi Arleta,
      
      I need to work it out to be able to just change the versioning of only OneDrive for Business tenant wide, instead of the entire SharePoint lists and Libraries. Is it possible? Can you please help me modify it for OneDrive for Business?
      
      Regards,
      Maaz
    • Hi,
      
      Happy to help. There you go: https://gallery.technet.microsoft.com/office/Set-the-version-limit-for-370ae6ec
    • Here is one more. This one works with all the users. The previous one works with selected users specified in a csv file.
      
      https://gallery.technet.microsoft.com/office/Set-the-version-limit-for-65c547fe
  • Errorwhen running Script
    2 Posts | Last post November 30, 2018
    •  
      Can you help me understand and correct this error:
      
      Set-VersionLimit : The term 'Set-VersionLimit' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or 
      if a path was included, verify that the path is correct and try again.
      
    • Hi dpc41,
      
      The file here is an entire script, not a cmdlet you can re-use. I am guessing (please correct me if I am wrong) that after running the script, you try to use the cmdlet.
      
      Try instead to open the file, enter the url you are trying to connect to and run the entire script. 
  • Will this work on Sharepoint 2013?
    2 Posts | Last post September 13, 2018
    • Hi, will this code work on Sharepoint 2013? I have an on premises server and need to do this exactly.
    • Hi Paul,
      
      Yes, the logic is the same. What you need to do is change the authentication:
      $ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Username, $Password)
      
      Have a look at the following article:
      https://bramdejager.wordpress.com/2013/08/02/using-csom-and-powershell-to-query-sharepoint-online-or-on-premise/