SharePoint Versioning Trivia, or maybe a start on a versioning FAQ


The number of versions retained is one more than the limit you set. Entering 10 as the version limit will keep up to 11 versions of the item. I guess the current "version" is not counted as a "version".


Then maximum number of versions per item is 5000. (at least in SP 2010)


We you exceed the version limit the oldest item is immediately discarded. It is not moved to the recycle bin.

Only libraries support Minor or Draft versioning. Lists only support major versions.

The maximum number of draft versions is 511, and you can't change that number. Attempting to create a 512th draft version generates this error:


"Keep drafts for the following number of major versions" will automatically discard minor versions of published major versions over the entered limit. Actually… it will keep one less than you probably expect.


For example, if the limit is 3 and you have some unpublished drafts, then you will see drafts from the previous 2 published versions plus the current drafts:

image   (click image to enlarge)

Notice that you see 13.1, 14.1, 15.1 and 15.2, but not 12.1. Three sets of drafts as expected. Now let's publish 15.2 into 16.0:

image(click image to enlarge)

Now we only have two sets of drafts, 14.1 and 15.1.


Clicking "Delete All Versions" actually deletes all but one version. The latest version is retained.

Reducing the version limit will not automatically delete excess old versions. The excess old versions will be deleted the next time the item is deleted. (You can create a PowerShell script to clean out the excess versions.)

Visitors to the site can see all of the old versions by default. You may want to edit the Read and View Only permissions levels to remove the "View Versions" permission.

Major version numbers are assigned internally using “version number” times 512. You can see this when display a version of a list item. Example of a direct URL: http://intranet /Lists/Announcements/DispForm.aspx?ID=1&VersionNo=1024
No that’s not version 1,024! Version numbers are assigned using “version number” times 512. Version 1 is 512, version 2 is 1024, version 3 is 1536 (i.e. 3 * 512), version 4 is 2048 (i.e. 4 * 512) …


Notes for developers and PowerShell scripters:

Versioning related properties of SPListI:

  • .MajorVersionLimit – the "Keep the following number of major versions" field in Versioning Settings
  • .MajorWithMinorVersionsLimit - the "Keep drafts for the following number of major versions" field in Versioning Settings

Versioning related properties of SPListItem:

  • .Versions – a collection of retained versions
  • .Versions.Count
  • .Version[0]  gets the most recent version of the item
  • .Verions[x] where x is .Versions.Count, is the oldest version of the item (i.e. versions are stored in reverse order)
  • .HasPublishedVersion   -  boolean


Here's a little PowerShell script that will take the first document (ID=1) in the Shared Documents library and create 10 major versions, each with two minor versions.

# before running this, enable major and minor versioning on the library

# get the web site
$web = Get-SPWeb http://intranet.contoso.com

# publish the first document 10 times
for ($versionsToCreate=0; $versionsToCreate -lt 10; $versionsToCreate++)
  # get the document
  $doc = $web.lists["Shared Documents"].getitembyid(1)

  # create two minor versions
  for ($x=0; $x -lt 2; $x++) { $doc.update() }

  # publist the last minor as a major version


Emma said...

Hey Mike,
Interesting post.I never heard about this.Why the number of versions retain one extra than the limit we set?

Mike Smith said...

Maybe their thinking is "the document" plus "x versions".

Heinrich Ulbricht said...

Small typo: 50000 versions - at least the screenshot says so :)

Note to spammers!

Spammers, don't waste your time... all posts are moderated. If your comment includes unrelated links, is advertising, or just pure spam, it will never be seen.