Share via

How to preserve the document ID in SharePoint 2016 after moving the file to a new location and make sure the new URL is not broken?

Anonymous
2023-03-07T14:30:14+00:00

Hi!

There are two use cases when looking to move a file:

  1. Move within the same site
  2. Move between different sites

We wanted to use the CSOM SharePoint library to move files. I have tried using both manual methods and using CSOM libraries in C# to achieve the desired results. I will mention the outcomes regarding both the cases below.

Moving file within the same site

MoveTo CSOM function

On using the File.MoveTo CSOM function, we noticed that although the document ID remained the same (visible in the Document ID column in the folder/library UI), if we tried to access the document using the document ID URL (by clicking on the three dot menu next to the file), it was not working and giving an error: "No documents with the ID <Doc ID> were found in this site collection."

We found some resources online, that said it takes some time for the server to crawl and update the references to the new document location. But even after trying to access the file after 24 hours, it was giving the same error.

Another article mentioned that the type of file also matters, like Office files such as Excel, PPT, Word etc. might behave differently. These results were tried for .PNG files.

Manually using Content and Structure

After this we tried manually moving the file by going to Site Settings --> Content and Structure. But again we faced the same issue and the document ID URL which was working for the newly uploaded file, was broken even after 24 hours.

Moving file between different sites

Manually using ShareGate 'Copy Content'

We tried using ShareGate to copy and then delete the file between different sites (within the same tenant). ShareGate provides some custom options like either to preserve the document ID or assign it automatically or even enter a custom document ID. We tried all the options, but on preserving the document ID we encountered the same error as above.

When we chose the option to automatically assign the document ID, it assigned it according to the prefix defined in the destination site and the document was accessible through the new document ID URL.

Summary and Questions

In short these are the questions, I have:

  1. Why is the document ID URL not working even on moving the file using the Content and Structure option?
  2. How can we have the ideal behavior of keeping the same doc ID and also keep the URL working, so that any places where the document was being referred to, still works?
  3. Let's assume if we are able to keep the same document ID after moving between different sites, the URL still has a part of the new site in the document ID URL. For example, the doc ID URL changes from

https://<tenant>/<collection>/<source_site>/_layouts/15/DocIdRedir.aspx?ID=<Doc_ID_VAL>

to

https://<tenant>/<collection>/<dest_site>/_layouts/15/DocIdRedir.aspx?ID=<Doc_ID_VAL>

So, any older links using this document ID would break? (I did see some article mentioning that SharePoint takes care of this by redirecting the older URL to the new one)

Any guidance regarding this would be appreciated! Thanks! :)

Microsoft 365 and Office | SharePoint | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

1 answer

Sort by: Most helpful
  1. Anonymous
    2023-03-07T15:46:06+00:00

    Dear Sukrit,

    In SharePoint Online, the Document ID will be retained in the destinated site which is enabled with the Document ID feature when moving files between sites.

    Enable and configure unique Document IDs - Microsoft Support

    As the issue is related to the Document ID doesn't work when moving the files with Document ID in SharePoint Server after using the Site Content and Structure administrative page in Site Settings, I suggest you post a new thread on our specific channel Microsoft Q&A - SharePoint Server for further help.

    Sorry for that our category may have limited resources on SharePoint Server related issues and questions.

    Thanks for your understanding!

    Cliff | Microsoft Community Moderator

    Was this answer helpful?

    0 comments No comments