Turn on Previous Versions For All in Office 365 OneDrive for Business

article #976, updated 2821 days ago

There is a mixture of public reference statements as to whether or not Previous Versions, also called Versioning, is enabled in OneDrive for Business, which is really a second frontend for Sharepoint. Recently a new installation was studied and there was a mix of automatic activations of Versioning for different libraries and lists made, without clear logic behind. Versioning is essential as a backup method for many related uses, so it becomes essential to know how to turn it on automatically for all libraries and lists of an entire Office 365 tenant. And right now, this appears to be the only published way, a contributed script in the Office 365 Gallery:

https://gallery.technet.microsoft.com/office/Enable-versioning-for-all-ae5cfb5d

In order to use it, one first installs:

Then log into the Office 365 tenant as an administrator, and click Sharepoint. You’ll be looking at the page for a URL something like this:

https://partofmydomain.sharepoint.com/_layouts/15/sharepoint.aspx

Now run PowerShell as administrator, take the “partofmydomain” chunk of text from your browser, and form the SharePoint admin URL. Don’t browse to it, but you’ll need it shortly:

https://partofmydomain-admin.sharepoint.com

Now you’ll need the script from the web page referenced at the top of this article, saved to a location to which you can CD in PowerShell. Get to that location in the shell, and run ‘notepad versioning.ps1’, towards the end you’ll see two path lines:

Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll"  
Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"

The 15’s need to be changed to 16’s to match the current version of the Sharepoint installables above. Once you have this, run:

Set-ExecutionPolicy Unrestricted

in PowerShell if you haven’t already, and then:

./Versioning.ps1

It will ask you for the URL; give it the one you constructed above. Then it will ask you for admin credentials. Once it has them, it will run through every list and library, and if Versioning can be turned on, it will be.

Categories: