Question

Due to third party Software installed in our SharePoint environment we have a number of documents with the same DocumentID. I am working on a PowerShell script that will check each item and assign a new DocumentID to the item if it is not unique.

However I have run into an issue when trying to find properties that make up the actual DocumentID within SharePoint. I realise that the first part of the ID is the Prefix that is set at the Site Collection Level and the last part is the Document Item ID of the document from the Library in which it is stored. I have managed to access these properties fine in PowerShell. My issue comes when I have been trying to find out how to access the middle part of the Document ID, I have looked into this and have seen threads where this is described as the ID of the list in which the Document is stored? I have tried looking at list properties but I have not come across the ID I am looking for, I have only been able to get the GUID of the list.

Any help that suggests I am along the right track and even anyone who knows how to access this value in SharePoint would be greatly appreciated.

Was it helpful?

Solution

In theory each list in a site collection will have a unique ID much like the List Item ID. You can see it via:

$list.RootFolder.Properties["docid_msft_hier_listid"]

You will need to clear all the docid settings for each item, get an instance of the DOCID provider and call GenerateDocumentID:

$provider = [Microsoft.Office.DocumentManagement.DocumentId]::GetProvider($site)
$provider.GenerateDocumentId($item)
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top