SharePoint 2010 Cookbook: Document IDs

SharePoint 2010 delivers a comprehensive set of document management features. In this article, we continue our series with a look at how Document IDs work.


In our company, we use SharePoint to manage our documents. Our SharePoint is deployed and used companywide, but the management of each site collection is left to each department or project manager. We use alerts and workflows with references to documents stored in SharePoint.  One of the problems we have is referencing documents using names or titles, which are often unresolved as authors update and rename documents all the time.

Besides using unique document Titles and Descriptions, what other choices do we have?


SharePoint 2010 includes a new Site Collection-scoped Feature called the Document ID Service, which is designed to create and assign a unique ID for each document and document set in your SharePoint environment.  Once a unique document ID is established for a document, it will remain unchanged when you change its other properties, or even when you move the document to a different location.

In order to use this feature, you will have to activate it at the site collection settings.  Go to Site Settings > Site Collection Features, or launch the SharePoint 2010 Management Shell and run the following:

10-12-2010 11-10-59 PM

Note: you can also enable the Document ID feature running this command  “Enable-SPFeature -id docid -url <site collection url>” using the SharePoint 2010 Management Shell.  Next, select Document ID settings in the Site Collection Administration page:

10-12-2010 11-10-59 PM

Enable the Assign Document IDs check box, and optionally give a prefix if you want all of your documents to start with the same text.

10-12-2010 11-10-59 PM

Once the Document ID feature has been activated, you should be able to view the properties of a document in your document library and you will see a field called Document ID:

10-12-2010 11-10-59 PM

If you do not see the Document ID field, beware that that this ID field is generated a timer job which is set default to run just once per day.  See the Notes section below on how to start the timer job manually.  Also, if you have existing documents, you will have to update the item before a Document ID can be assigned.

Now that you have a unique document ID for this document, you can always refer to it using this URL:  http://<ServerName>/_layouts/DocIdRedir.aspx?ID=PCPSF3FMA74P-1-13.  Notice the DocIdRedir.aspx page in the _layout directory of the site collection.  This page basically takes the document ID as a query string and finds the current location of the document, even if you rename or move the document elsewhere in the Site Collection.


Keep the Document ID in the document

A nifty feature to be aware of is that you can actually insert this Document ID in your document.  How?  It’s actually pretty simple.  Go to your document library and edit the document:

10-12-2010 11-10-59 PM

Then in Microsoft Word (or another Office application), select Insert > Quick Parts > Document Property.  In the drop down, you will see a list of properties including the metadata from the SharePoint Document ID.  If you read this previous Document Set article, you will have noted that the Project Manager and Project ID also came from the properties of the Document Set  that was defined in your document library.

10-12-2010 11-10-59 PM



  • Document IDs are only available in SharePoint 2010 Server and are not part of the free SharePoint Foundation 2010 version.
  • Document IDs are scoped at Site Collection level.  In other words, document IDs are unique per Site Collection.  But as you notice in the settings page, appending a unique prefix text per Site Collection, you can almost guarantee unique IDs across a SharePoint farm.
  • When you MOVE a document within a Site Collection, its ID will be kept.  When you COPY a document to a new location, the new copy will have its own document ID.
  • If you are using Document Set, the set will have its own unique Document ID that is independent of each document in the set.
  • When you activate the Document ID feature, a new column is added to store the document IDs (it actually adds a new column to the Document content type; that’s why your documents have to be based on this content type in order to get this column).  If you then deactivate the service, the existing document IDs are still valid, as the document ID columns are not removed, but SharePoint will not generate and assign new IDs.
  • There are two timer jobs related to the Document ID services: Document ID enable/disable timer job and Document ID assignment timer job.  Make sure these services are running in the Central Admin site.  Note that this job is run once per day default, so it might take a while for SharePoint to generate the IDs. If you want the job to execute immediately, select the Document ID assignment job and click on “Run Now”.

10-12-2010 11-10-59 PM


  • Since Document IDs are unique and do not change, and given the new ability to uniquely name documents, you should be able to satisfy some Record Management policies within your company.
  • If you enable Document IDs on a site that has existing documents, those documents must be “touched” or modified before its IDs are generated.  You can also force a timer job to run and generate IDs for all documents.
  • You can also extend the document features providing your own Document ID provider.  This can be useful when your company requires a very specific ID format.

Current limitations of Document IDs include:

  • Only items based on content types that inherit the out-of-the-box Document Content Type may have unique IDs.  This is pretty restricted, so design your document library and types carefully.
  • If you export (or backup) documents from one SharePoint farm and then restore to another farm, the Document IDs will NOT be preserved.


See Also: