SharePoint Online and Document ID. The Goods.

Reading Time: 5 minutes

I’m currently provisioning modern Team Sites in SharePoint Online and was asked how/if we could uniquely identify a document within a site and tenant. There’s a site collection Document ID feature I’ve used in SharePoint on-premises environments in Classic site collections to do this, however I’d never tried it in SharePoint Online on a Modern Team site. I was curious to see if it worked the same and what the use-case would be for something like this.

Once the Document ID feature is activated, 3 important things happen:

  1. Every document on the site will be assigned a unique Document ID
  2. Every document on the site can be retrieved with a URL of /_layouts/15/DocIdRedir.aspx?ID=<Document ID> and this is rendered as the Document ID (Linked to document) URL column on the All Documents view
  3. You can search for the document by the Document ID and the managed property DlcDocId

The advantage of a Document ID is it won’t change (some caveats – I’ll talk about these). This is beneficial if you want a way of always being able to retrieve a document using the Document ID even if it moves from its original location.

Reference: Document ID Feature

To test out the Document ID feature in a Modern Team site, I wanted to see if either the Document ID value or the Document ID URL changed for any of these scenarios:

Test Cases

Note: I am NOT referring to the Copy link URL you get for any document across your tenant. If you move the document, that will change. Instead, I’m referring to the Document ID URL column created when you enable the Document ID feature.

TDLR? Skip down to the Summary section and I’ll tell you what I found.


Once the Document ID feature is activated, a new Site Collection setting will appear called Document ID settings (image). This setting allows you to enter a prefix (up to 12 characters) to customize your Document IDs and optionally reset all document IDs in the site collection to inherit the prefix. If you check this option, a timer process will run in the background to do this; typical with any timed process in SharePoint Online, you have no insight into when this will happen but it’s likely a factor of the number of documents you have in your site collection. My experience so far has been within a day the reset will happen.

Document ID Settings

For my test cases, I set the prefix to JOJODOC to force all Document IDs on the site to follow this format:


I uploaded 6 documents into the Documents library and all 6 were immediately given a unique Document ID with the prefix:

Test Case documentsThe circled column is a URL column in the format:

/_layouts/15/DocIdRedir.aspx?ID=<Document ID>

Test Results

Folder Move

I created a folder in the Document library above and moved one of the documents into the new folder.

Folder moveSomeOtherFolder

Folder move test results:

  • Underlying Document ID URL link remained the same
  • Document ID remained the same

Library Move

I created another document library in the same site called SomeOtherLibrary and moved one of the documents from above into it. The document ID stayed the same.


Sidebar: When I uploaded a brand new document into SomeOtherLibrary, I noticed the number portion of the Document ID it generated was different indicating that portion of the ID is unique to a document library.

Document ID moved to library

Library move test results:

  • Underlying Document ID URL link remained the same
  • The Document ID remained the same

Site Move

I created another Modern Team site called SearchTeam and moved one of the documents from the above into it.

Site move test results:

  • Underlying Document ID URL link changed to point to the new site collection
  • Document ID may change depending on the following…

If the Document ID feature isn’t activated on the destination site, I’m warned of losing properties at the destination… in this case, the Document ID. This behavior is consistent with the warning received when any kind of metadata on a document is not at the destination location.

LoseMetadata on move

If I choose to move the document anyway, the Document ID property will be lost.

If the Document ID feature is activated on the destination site, the Document ID will be carried over in the Move operation, even if you have a different prefix defined on the destination site. In this example, the Document ID prefix I’ve defined at the destination site is JOJONEWDOC, however the old Document IDs are retained:

Document ID on different site

In short, the Document ID can only change if:

  • If you reset the Document IDs on the destination site to reflect its default Prefix, the Document ID will be updated for all documents in the site collection with the timer process, including the ones with the JOJODOC prefix
  • If you move a document with a Document ID to a site collection without the Document ID feature activated, the document will lose its Document ID


You can use the Document ID to retrieve a document even if it moves out of its original location (folder, library) and even site collection IF the Document ID feature is activated at the destination site as well.

Because the Document ID doesn’t change (unless you’ve intentionally reset it), there are 2 ways you can leverage it to retrieve a document:

  1. Search for it across your Tenant


Because the Document ID column has a search managed property automatically defined (DlcDocId), you can use it in a search query to retrieve the document from anywhere across your tenant.

  1. Leverage the Document ID column in your views (DocIdRedir.aspx)

You can retrieve a document by its Document ID even if it moves outside of the initial site collection by using the DocIdRedir.aspx page on the site collection it’s in. This is what the Document ID (linked to document) column will use:

/_layouts/15/DocIdRedir.aspx?ID=<Document ID>

What’s the use-case?

In a Classic site, there’s a web part to allow you to retrieve a Document by it’s Document ID, however the equivalent web part doesn’t exist in the Modern world.


You can , however still use the Document ID (linked to document) column on your views to retrieve a specific document or use search directly if you know the Document ID.

This feature could be beneficial in solutions where you need to have a unique identifier for a document however it doesn’t guarantee the underlying Document ID URL won’t change if you’ve moved it to another site or renamed the Document ID – an important distinction.

Thanks for sticking with me. 🙂



  1. Do you know if the Document ID feature can be turned on for a tenant? Or do you have to enable the feature for each site manually? If it’s possible to enable by default for all sites, would that be a best practice? Thank you for any insight – this post was very helpful!

    1. Hi Curtica, You cannot enable it at the tenant level, must be done at a site collection level. That is not a “best practice”… It is dependent on your use case and why you need a unique document ID in the first place. If you won’t be leveraging it, not much use for it. On collaboration sites, I don’t see it being used, I see it more on a controlled document site however it’s dependent on how/if you plan on using it.
      Hope that helped.

  2. Great article but I think it a real shame that 17 years on from the birth of SharePoint Microsoft till have given us an immutable document id / link feature that works across your SharePoint estate. An additional point worth making is that the document id feature doesn’t work for folders only document sets and the later are not fully supported in SharePoint Online so we are actually going backwards if your want an immutable id for a collection

  3. Hi
    Do document ID’s embed any information relating to the author, creation date or other fixed document properties and do systems maintain a separate log of document id’s

    1. Hi Paul, there is no additional information embedded with a Document ID that I’m aware of. You can use the Document ID to query for that information though. (thru code) When you say ‘do systems maintain a separate log of document id’s’, what ‘system’ are you referring to? SharePoint keeps track of these Document IDs in its proprietary database but this is nothing you could query directly against. I’m not sure I answered your question on that one.

  4. What happens to DocID when that site collection is migrated to SP online? I’m assume they all break and the service has to be turned on and reran?

    1. Hi Annette, I don’t know – never tried this. It should be a simple test you could do using a migration tool though.

  5. Hi Joanne,

    Thank you for the perfectly written article. Is there any way to manually assign (or change) a Document ID to a document? Trying to find a way to have permanent links to a document even if a new revision of the file with the new file name, different from the previous one has been uploaded to SharePoint.

  6. Hey Joanne, can we have multiple patters of the document IDs, I mean to say based on the type of the document uploaded, the relevant pattern should be assigned. For Ex: For One type it is “JOJODOC-“, for another it is something else.. Is it possible?

  7. Is there any way to find a document by means of it’s “Document ID” across hundreds of sites in Sharepoint Online using the REST API ?

  8. Thanks, Joanne, for your quick answer. However – the search API in REST also seems to require that you define a “site” to be able to search in that site – but that’s exactly what I **don’t** want – I need to be able to search inside my entire SP Online tenant, across **ALL** sites….. any further ideas? 🙂

    1. Hi, oh yes that’s right. Perhaps that’s what the Azure cognitive search api is addressing? No more ideas at the moment.

  9. Hi. Thanks for this, it really helps begin to solve a problem. We share a lot of document links internally and externally (to people with guest access). Using Doc ID rather than just the SharePoint link gives us flexibility over time in case files/folders, etc. get moved.

    Our real issue is usability of the link. To get the document ID link is a real faf, it is not available on the right-click menu. And confusingly, there is a “Copy link” on the right click menu, but this gets the “traditional” SharePoint link which does not persist if the document moves. To get the document ID link, you need to open properties, mouseover and copy it from there. Even if the Document ID column is added to the view, you can’t right click on that column to pick it up. And clicking the link in the view opens it in a new tab, but it resolves to the target document so it’s not as if you can copy it from there.

    Are there any ideas for how to increase usability of the doc id link?

    1. Hi, thanks for this useful post.
      There is a difference between SP 2019 and Server Subscription Edition. In Server SE you can choose “Details” in the context menue of a document and you find the DocID in the infopanel and you can copy the correct id Link with right click.
      A trick which works in both versions is “Shift + right click on DocID” in a view. This bypass the SP context menue and offers the browser menue to “copy link” in the docID variant.

  10. Finding docs across the site collection is exactly what I’m looking for, too. I’m disappointed that document ID doesn’t show in PowerBI default values (very limited in my opinion). I’m going to try the search APIs.

  11. Hi Joanne, is it possible to configure the documentid service using Powerautomate. I can turn on the feature but i see no options to dynamicaly configure the ID service. I want to use a projectcode (fixed for a site collection) as prefix in the documentid

Leave a Reply to ekstonCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.