The SharePoint Document ID Service is a new feature of SharePoint 2010 that offers a number of useful capabilities, but carries some limitations. Let’s dig a bit deeper and see what it does and how it works.
One challenge for SharePoint users is that links tend to easily break. Rename a file or folder, or move the document, and a previously saved or shared link will not work. By tagging a document with an ID, SharePoint can start referencing documents using this ID, even when the underlying structure beneath it has changed. SharePoint can accept a link with this ID, by referencing a dedicated page on each site that takes care of finding the the document. This page is named DocIDRedir.aspx. Here’s what a URL might look like:
There’s also a Document ID web part that’s available for users to enter a Document ID. This is used most prominently when creating a Records Center site, which is based on an out-of-box website template.
The Document ID Service is enabled at the Site Collection level, and assigns Document IDs that are unique only within the site collection. There is a prefix available for configuration that is most useful when assigned uniquely for each Site Collection to ensure uniqueness across your web application and even farm. If you have more than one farm, it makes sense to provide an embedded prefix to indicate the farm, to ensure uniqueness globally.
Setting Document ID
Once the Document ID Service is enabled, every new or edited document instantly gets a Document ID assigned. However, historical documents do not get an immediate Document ID assignment. The assignment of Document IDs to documents that were uploaded prior to this service being enabled are assigned by a Timer Job called the “Document ID assignment job” that exists at the Web Application level. By default this job runs nightly. This is one of two jobs associated with the Document ID Service; the other being the “Document ID enable/disable job “
When the Document ID Service is enabled for a Site Collection, Event Receivers are automatically installed in each Document Library. Actually there is a set of Event Receivers installed for each and every Content Type configured within that document library. The Event Receiver is called “Document ID Generator” and is configured to by fired synchronously. There is a separate Event Receiver for the following events:
Once a Document ID is assigned, it is changeable through the Object Model, although do so at your own risk. Before the Document ID Service is enabled, the Document ID field does not exist to be assigned. if you are migrating from a legacy system that has existing Document IDs, you can first migrate the documents, then the Document ID service is enabled. This adds the internal Document ID field. Then before the daily Document ID Assignment job runs (better yet, disable it during this process), we can programmatically take the legacy Document IDs and assign their values to the SharePoint IDs. With the Document ID field populated, the Document ID Service will not overwrite the already set Document IDs.
Note that part of Document ID Service is to redirect URLs referencing the Document ID. It turns out, if you manually assign duplicate Document IDs (something that in theory should never occur), the daily Document ID Assignment Job detects this situation, and the DocIDRedir.aspx redirects to a site-based search page that passes in the Document ID.
Under the covers there are three internal components to a Document ID:
- _dlc_DocIdUrl: fully qualified URL for document referencing the DocIDRedir.aspx along with the lookup parameter
- _dlc_DocId: The Document ID. This is the internal property you can directly address and assign as $item[“_dlc_DocId”]
- _dlc_DocIdItemGuid: DocID related GUID
That completes our tour of the Document ID Service. I look forward to hearing of others’ experience with it.