Do documents in SharePoint have a unique ID?

Document GUID

All documents in SharePoint get a unique GUID that is shown as a part of the document’s URL (after the query string “sourcedoc”), when you open a document in the browser.

A document with this specific URL:
https://contoso.sharepoint.com/:w:/r/sites/Test/_layouts/15/WopiFrame.aspx?sourcedoc=%7B1863aae9-cdd1-4dfc-881d-293a419d14ad%7D

Has “{1863aae9-cdd1-4dfc-881d-293a419d14ad}” as its GUID (after having replaced “%7B” with “{” and “%7D” with “}”). This GUID is unique within your SharePoint tenant and if a document is moved between 2 document libraries within the same site collection the document’s link will be intact. If the document however is moved between site collections, the link will be broken (the document will get a new GUID).

You can also search for a document with a specific GUID:
Search using a GUID

Document ID

All documents in SharePoint have an ID that is unique to the document library where the document is stored. The first document in a library gets ID 1, the second ID 2, etc. If a document is deleted, the ID will not be reused. If a document is moved within a document library (moved from one folder to another within the library) the ID will remain intact. If it however is moved to another document library, in the same or another site collection) the document will get a new ID, the next available ID in the destination library. Here you see a document list with the document ID shown in the view:
ID column shown in the document view

Unique Document ID

It is also possible to create a unique number series per workspace, such as e.g., “CERT17-87686876-1”, where the prefix, in this example (CERT17) would be unique per workspace, so all documents would get a unique ID in your tenant. This unique document ID feature is not activated by default in SharePoint (this needs to be done per workspace), but the activation could be automated by creating a site template for this and once you have your site template in place you can define which workspace configurations should use this site template.

If you manually want to activate the feature, then follow these instructions:

  1. Open the workspace.
  2. Open the workspace in SharePoint.
  3. Click on the “SharePoint Settings” icon and select the ”Site information” option:
    Menu under site settings
  4. On the next page, click on “View all site settings”:
    Link to view all site settings
  5. Under the “Site Collection Administration” section, click on the “Site collection features” link:
    Site collection features
  6. Find the feature called “Document ID Service” and click on the “Activate” button:
    Document ID Services
  7. Once it has been activated, go back to site settings and click on the “Document ID settings” link select Under the “Site Collection Administration” section:
    Document ID settings
  8. On the “Document ID Settings” page, in the field “Begin IDs with the following characters” field, fill in a prefix that you would like to have for documents stored in the site collection. Enable the “Reset all Document IDs in this Site Collection to begin with these characters” checkbox:
    Setting the document ID settings

To be able to configure MetaShare to show Document ID as a column in workspaces, you first need to also activate the “Document ID Services” feature in SharePoint’s content type hub). Once this is done and you have configured your workspace configuration to show the column in the document view, you will be able to view the Document ID as a document column in workspaces:
Document ID in MetaShare

You can also see the Document ID in the document property form:
Document ID in document property form

When you have activated the “Document ID Services” feature, documents will keep their Unique ID even after having been moved between different site collections and the Document ID can added as an embedded metadata by inserting a quick part called “Document ID Value” in Word documents:
Document ID Value as a Quick Part

You can also search for a document using the unique document ID but first you need to create a new managed property, check the property’s “Searchable” setting and map it to a crawled property called “ows__dlc_DocId”. For instructions on how to do this, se this page: How to configure managed properties, under point 3. Once the documents have been indexed this is how it will look like when you search for a unique document ID:
Search for unique document id