Using Document IDs with SharePoint Online

Last Update: Sep 04, 2024 | Published: Jan 22, 2019

SHARE ARTICLE

sharepoinmt hero

Looking For Buried Office 365 Features

One of the joys of Office 365 life is finding features buried in an application that you never knew existed. It’s possible that you might never end up using the feature, but there’s a certain deliciousness in discovering something new and probing how it works. Which is what happened when I stumbled across automatic SharePoint document IDs, a way of assigning a system-generated identifier to documents. The document ID service goes back to SharePoint 2010, when Microsoft introduced the feature as part of its expansion of SharePoint’s record management capabilities.

I’ve worked with legal and government agencies over the years and understand the deep and abiding love that exists in some quarters for document ids, which they can use as file or case numbers. The thought of referring to a document as PRJ0-1974991961-1874 instead of MyDoc.docx might not appeal to you, but it does make sense when you want to be able to assign a unique identifier to a document in a mass of many hundreds or thousands of similar documents.

Enabling Document IDs for a SharePoint site

Most SharePoint Online site collections belong to Office 365 Groups or Teams (aka, modern team-enabled sites). I selected a couple of groups to play with document IDs. The directions to enable the Document ID service in Microsoft’s online documentation were incorrect (they might be adjusted now). To enable the Document ID service, a site administrator (group or team owner) or tenant administrator performs the following steps:

  1. In a document library for a group or team, click the cogwheel icon and select Site information.
  2. Select View all site settings at the bottom of the panel to go to the Site Settings page.
  3. Select Site collection features under Site Collection Administration (remember, the sites used by Office 365 Groups and Teams are the only site in a site collection).
  4. Scroll down to Document ID Service. Click Activate to enable the service for the site. A button labeled Active appears after SharePoint activates the service (Figure 1).
  5. Go back to the Site Settings page and select Document ID settings under Site Collection Administration. You can now assign a prefix for the document IDs. The prefix is an alphanumeric value (no special characters) between 4 and 12 characters (Figure 2).
  6. If you want SharePoint to generate document IDs for all libraries in the site, check the box Reset all document IDs in this Site Collection to begin with these characters.
  7. Click OK. After a short delay to allow SharePoint to update settings and launch the background job to assign IDs (if chosen) to existing documents. There’s no way of knowing exactly how long SharePoint will take to assign IDs to existing documents, but it should happen within a day. While the background job progresses, any new document created, copied, or uploaded to any document library in the site receives a unique document ID.
Document ID Site
Figure 1: Enabling the Document ID service for a SharePoint site (image credit: Tony Redmond)
Document ID Settings
Figure 2: Entering settings for the Document ID service (image credit: Tony Redmond)

Viewing Document IDs

SharePoint stores the ID as part of a document’s metadata. You can see the document ID by viewing the properties of a document or by adding the Document ID to the list of columns displayed in a library view (Figure 3). This kind of extended information isn’t revealed by the simplified “Files” view for SharePoint document libraries currently used by Teams (Microsoft is due to make a new Files interface available for Teams soon).

Document ID SPO
Figure 3: Document IDs in a SharePoint library view (image credit: Tony Redmond)

A document ID is composed of:

  • The prefix you assign (in this case, PRJ0).
  • A ten-digit value assigned by SharePoint for the site (1974991961).
  • A number for the document that increments as items are added to the site.

Using Document IDs

If you select a document and view its properties, you see that the document ID is a hyperlink that you can copy and reuse to open the document using Office Online (Figure 4). The link is of the form:

https://office365itpros.sharepoint.com/sites/raprojects/_layouts/15/DocIdRedir.aspx?ID=PRJ0-1974991961-29

When opened, this resolves to a link like:

https://office365itpros.sharepoint.com/:w:/r/sites/raprojects/_layouts/15/Doc.aspx?sourcedoc={cbbfdc98-5753-47c7-ac93-7749184c155f}&action=default&mobileredirect=true

Document ID SPO document
Figure 4: A document ID viewed as part of the properties for a selected document (image credit: Tony Redmond)

Searching SharePoint Using Document IDs

Apart from anything else, SharePoint stores document IDs in a managed property called DlcDocId, which means that you can search for a specific document by using a search command like:

“DlcDocId:PRJ0-1974991961-29”

This works very nicely with SharePoint search because it knows the difference between queryable and searchable properties. A property is queryable if you can find things by including the property name and a value in a search. It is searchable if you only need to include the value.

Once you move outside SharePoint, other Office 365 searches like Delve or Office 365 content searches won’t find items based on document IDs unless:

  • Users add the document ID to document properties (for example, as a tag) or in the content of the document (the general body or header/footer). This isn’t as big a problem as it seems because if a tenant sets out to use document IDs, they will likely incorporate IDs in the workflow used to name and classify documents. For instance, to set up a new case file, they could create a base document and then use the assigned ID to mark all the other documents and email associated with the record.
  • A tenant administrator updates the SharePoint search schema with a new managed property to make the ows_dlc_docid crawled property searchable. After updating the schema, you need to reindex the sites that use document IDs. Following indexing, you’ll be able to search using an exact document ID.

If you don’t know much about how the SharePoint search schema works, it’s probably a good idea to consult an expert before you make changes of this nature for a production tenant.

What Happens When Documents Move Within SharePoint

An advantage of any identifier is that it stays consistent throughout a lifecycle. In the case of document IDS, this is true if:

  • The document stays in the same site (it can be moved between libraries).
  • The document moves to a different site where the Document ID service is also enabled. If the Document ID service is not enabled, the move removes the identifier. If you then move the document back to its original site, it gets a new identifier.

In addition, if you reset the document identifiers for a site and choose to update all current documents, the original identifiers are overwritten.

SharePoint Document IDs Not for Everyone

Document IDs won’t inspire or excite everyone. It is a concept for those interested in records management rather than those who simply want to use SharePoint as a convenient place to hold documents. But you never know when a feature like Document IDs might turn out to be useful, which is why I’ve left the service enabled for several of my sites.

SHARE ARTICLE