Durable Links to Files and Folders

I am confused about links to files and folders in SharePoint Online. Especially on their robustness in case these files or folders or any of their parents are moved or renamed. In one site I see the following kind of links. All were taken from the “…” –> “Copy link” menu. Unique Document IDs are enabled.

  1. Link to a docx: https://domain.sharepoint.com/:w:/r/tst/dir/(some other dirs)/file.docx?d=(some long id)&csf=1&web=1&e=(some other short id)
  2. Link to a folder: https://domain.sharepoint.com/:f:/r/tst/dir/(some other dirs)/testdir?csf=1&web=1&e=(some short id)
  3. Link to a any non Micosoft Office file: https://domain.sharepoint.com/:u:/r/tst/dir/(some other dirs)/email.msg?csf=1&web=1&e=(some short id)

In the details pane (the panel that appears on if you click on the “i” in a circle on the right-hand side) at the property Document ID is another kind of link:

  1. Link to a file: https://domain.sharepoint.com/tst/_layouts/15/DocIdRedir.aspx?ID=(document ID)

On another site I see yet another kind of link:

  1. Link to file or folder https://domain.sharepoint.com/:w:/s/Website_Test/(some long id)?e=(some short id)

The link in 1 works even if the file itself is renamed or moved (including renaming and moving any of its parent folders). However, this kind of link seems to be available only for Microsoft Office files.

The links in 2 and 3 seem to be of the same kind of links. They both no longer work if their targets are moved or renamed. They also stop working if any parent directory is renamed.

Link 4 works just as 1. However, for reasons unknown to me, I seem to have a few files with the same Document ID. Links to those files lead to a list of search results with all the files with the same ID.

Link 5 works just as 1 and is avaiable for files and folders. This kind of link seems to be the one you would want to use.

Now to my questions:

  1. Is there any documentation on the link format? I have only found some blogs or forum pages from SharePoint users but no official documentation.
  2. Is there any recommendation to use one kind of link over the other?
  3. Why do the sites produce different kind of links? Is there any way to control this?
  4. Some sites suggest that enabling unique document IDs will give links of the form 4. on “…” -> “Copy link”. Since this is not the case on my site I wonder if there is something wrong.
  5. Why do some documents have the same Document ID?