Document Versioning in SharePoint 2010

By:   |   Updated: 2010-11-09   |   Comments   |   Related: > SharePoint Document Management


Problem

When you store critical documents in the SharePoint libraries, sometimes it becomes necessary to track all the changes and to maintain version history for them.

Solution

There might be a time when you would need to restore files back to an older version if any inadvertent change happens. You can also track changes for auditing purposes.

So how does SharePoint allow creating different versions of documents? How does version history work? What are the different types of versions we can maintain for our library or list and how can we revert back to an older version?

SharePoint allows you to enable (by default it's disabled) versioning on lists and libraries. Once enabled, SharePoint will maintain multiple versions of the document or list which gets incremented on each change iteration. There are three different versioning settings:

  • No versioning - This is the default setting in which the current version overwrites the older version. There are no previous versions stored. This setting is not recommended especially if your document library contains critical or important documents.
  • Create major versions - Also called simple versioning, in this setting the document versions will be numbered with whole numbers, called major versions, i.e. 1, 2, 3, 4 etc.
  • Create major and minor (or draft) versions - In this setting document versions will be numbered with whole numbers˙(1, 2, 3, 4 etc.) as well as numbers with decimals (.1, .2, .3, .4 etc.). The whole number is called the major version (indicates final copy) and the numbers with a decimal are called minor versions (indicates work is still in progress). You use this setting if your document goes through several iterations/drafts/reviews (minor versions) and you want only the final copy (major version) to be published to a broader audience.

Please note for a list or list items, the only option available for versioning is creating major versions, no minor versions are created.

Once versioning is enabled SharePoint automatically and transparently creates the next version of the document whenever a user updates a document in the library. These are some of the different scenarios when SharePoint will create a new version for your document or list item:

  • When a new document or list item is created or uploaded into SharePoint, version 1 is created if the option Create major versions option is enabled or version 0.1 is created when Create major and minor (or draft) versions is enabled (not applicable for list items) and when you publish it then next higher major version is created.
  • When you upload a document with the same name as an already existing document in the library and check the Add as a new version to existing files check box, the existing file becomes an older version and the new uploaded document will have next higher version number.
  • When any properties (metadata fields) of the document or list item is changed.
  • When you Check-in a document that was previously Checked-out.
  • When you open a document in the associated application, edit and save it for the first time. On subsequent changes no new versions will be created as long as you don't close the application and re-open it.
  • When you restore the old version of the document.

Please note, although the demonstration in this tip has been shown in SharePoint 2010, the versioning feature has been part of previous SharePoint versions as well.

Example

Select the library for which you want to enable versioning in the Quick Launch on the left side (or by going to All Site Content if the library is not visible in Quick Launch), under the Library Tools ribbon, select the Library tab. You will notice the Library Settings icon on the right side of the ribbon (shown below), Click on it.

library tools

In the Document Library Settings page, under General Settings click on the Versioning settings hyperlink as shown below:

Versio2

On the Versioning Settings page you will see four sections. The first section, Content Approval, lets you define a protocol to make versions available to everyone with the required permission only after that version has been approved by the authorized person or else changes will remain in draft versions.

The second section, Document Version History, is the place where you enable versioning for the library. By default the No versioning radio button is selected. Change it to either Create major versions or Create major and minor (draft) versions. Optionally you can define maximum number of major or minor versions that will be retained by SharePoint. If it crosses the defined limits SharePoint removes the oldest/first (lowest number) version and this way it maintains the maximum versions.

The third section, Draft Item Security, allows you to define who all will be able to see the draft/minor versions of the document, i.e. only users with read only access or only users with edit permissions or only by the author and persons who are authorized to approve the versions (people with Design or Full Control permissions).

The last section, Require Check-out, allows you to enforce Check-out to edit documents of the library by the users.

create major versions

When enabling versions for a list, you will notice a slightly different second section on the List Settings page as you can see below. As I said before only major versions are created for list items and this is exactly what you see here. Other sections remain same as discussed above for document library:

create a version

Once versioning is enabled, you can click on any document (tiny down arrow icon) and see the context menu as shown below. To review version history for that particular document, click onthe˙ Version History menu and you will see one screen with all the versions of that document as below.

version history
modified

You can click on any particular version of the document to either read it, delete it and revert to your current version with the selected older version. If you restore an old version, you will be prompted to confirm the replacement and if you select OK, the older version will be restored with a new version and the previously current version will become an old version.

version history
message from webpage

If you delete the original document, all the associated versions will also be dropped with it, though you have the option to delete a particular version as shown above. All those deleted versions move to the Recycle Bin as you see below (I deleted some of the versions of the document), if required you can restore back the document versions or delete it from Recycle bin permanently.

adventure works

Comparing multiple versions

MS-Office applications have integration with SharePoint and hence these applications allow you to Check-out a document, compare two versions etc. As you can see in the image below, it shows the list of versions of the opened document along with several other options.

technical design

These applications allow you to compare the versions of the document that could be either comparing two major versions or last two any versions.

versions and check out

In the screen below, you can see the comparison result of versions of the document. On the right top corner you can see the original document. On the right bottom you can see the changed document and on the left side you can see summary of the changes.

compare result

Enabling the Create major and minor (draft) versions option gives you slightly different options. As minor versions get created before a document gets published (at that time major version is created), you specify who all will be able to see these minor versions.

create major versions
any user

When you have a look into the version history of the document, when the library has been enabled for Create major and minor (draft) versions you will notice a slightly different view...

project plan
version history

A document needs to be published to create a major version and make it ready for a wider audience. To do that click on the document and then click on the Publish a Major Version menu as shown below. This will create a new major version of the document.

technical design document
version history

While publishing˙ a document (creating a major version), you can specify the comments about the changes to the version as shown below that helps in understanding the version when having a look into version history and hence help in tracking.

publish major version

If you have enabled Content Approval for your document library, you will notice two new menu options (Cancel Approval and Approve/Reject) as shown below. You can also see that the Approval Status for the document is Pending as it has not been approved yet:

approve

While approving or rejecting the version, you can specify your review comments in the comment section. (Shown below.)

approval status

Notes

  • For a SharePoint list the only option available for versioning is to "Create major versions".
  • You need Design or Full Control permission in order to enable versioning.
  • To disable versioning for a library or list, go to the Library or List Settings and select No Versioning and click OK. This will remove all previous versions and prevent future versioning.
Next Steps


sql server categories

sql server webinars

subscribe to mssqltips

sql server tutorials

sql server white papers

next tip



About the author
MSSQLTips author Arshad Ali Arshad Ali is a SQL and BI Developer focusing on Data Warehousing projects for Microsoft.

This author pledges the content of this article is based on professional experience and not AI generated.

View all my tips


Article Last Updated: 2010-11-09

Comments For This Article

















get free sql tips
agree to terms