Duplicate SharePoint Document ID

Xiaoyi 1 Reputation point
2022-04-27T10:37:55.387+00:00

i am using MS graph API to scan excel files in my sharepoint. As i have many files to process and i dont want to hand code the file names, i have a loop to automatically generate the file name and check if there is a valid document ID associated with that file name. If there is, scan begins. If there is none, skip scan.

now i am seeing a file name whose corresponding file never exists in my sharepoint is sharing the same document id of another file. as a result, this non-exist file is being scanned and its content is exactly same as the other file but named differently.

may i know why this happened and how can i resolve this?

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,607 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Xiaoyi 1 Reputation point
    2022-04-27T11:18:52.7+00:00

    Did some testing:

    Let's say FilenameA and FilenameB (both don't exist) are having same Document ID 123 as FileC (does exist)

    I make a copy of FileC in sharepoint (FileC - Copy is created)
    I delete FileC, keep FileC - Copy
    Now FileC - Copy has a new Document ID, 456
    I rename FileC - Copy to FileC, new Document ID 456 remains
    But, when i check Document ID of FIleA and FileB, instead of having Document ID as 123, both becomes 456.

    So it seems like FilenameA and FilenameB are "following" FileC and will "inherit" Document ID of FileC

    0 comments No comments

  2. Tong Zhang_MSFT 9,116 Reputation points
    2022-04-28T06:15:44.273+00:00

    Hi @Xiaoyi ,

    Thank you for the detailed description of the case.

    When I received the case, I searched a lot of documents did a lot of researches. And I feel regretful to inform you that no documentation has been found to explain this situation now.

    You can try to reset the Document ID to solve this problem:

    Solution 1:
    1.Go to Site Settings ->Site Collection Administration->Document ID settings

    2.Select "Reset all Document IDs in this Site Collection to begin with these characters.", then click "OK"
    197090-image.png

    Solution 2:
    Reset the Document ID of the file via PowerShell:

    # Provide credentials over here  
    $creds = (New-Object System.Management.Automation.PSCredential "<<UserName>>",(ConvertTo-SecureString "<<PassWord>>" -AsPlainText -Force))  
    
    # Provide URL of the Site over here  
    # If you do not wish to pass credentials hard coded then you can use: -Credentials (Get-Credential). This will prompt to enter credentials  
    Connect-PnPOnline -Url https://xxxxx.sharepoint.com/sites/xxxx-Credentials $creds  
    
    $file = Get-PnPFile "test_library/Document1.docx"  
    $file.ListItemAllFields["_dlc_DocId"] = "DOCID-567585"  
    $file.ListItemAllFields.SystemUpdate()  
    

    197139-image.png


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.



  3. Xiaoyi 1 Reputation point
    2022-04-28T06:30:15.507+00:00

    Another round of testing:

    I manually created 2 empty files with name FilenameA and FilenameB and uploaded them into sharepoint.
    Now I can see both have different Document ID than FileC.
    I thought this will change the Document ID of FilenameA and FilenameB for good and I do want to keep my sharepoint clean and tidy. So I deleted these 2 empty files.
    However, Document ID of FilenameA and FilenameB changed back after being deleted from sharepoint and now they are equal to Document ID of FileC again.

    0 comments No comments