Sharing links survive overwrite and rename, but not "recycle and upload again"
Links from Copy link resolve through the file's UniqueId. If your code publishes a new version of a document, overwrite the same file and rename it with MoveTo – links keep working. Recycling the old file and uploading a new one under a new name creates a new UniqueId, and every link people pasted into other documents, e-mails or Teams breaks.
Odkazy z „Kopírovat odkaz“ se dohledávají podle UniqueId souboru. Nová verze dokumentu = přepsat tentýž soubor a přejmenovat přes MoveTo; odkazy fungují dál. „Starý do koše, nový nahrát“ dá nové UniqueId a rozbije všechny vložené odkazy.
Measured (SharePoint Online, 2026-11)
| Operation | UniqueId |
Existing link |
|---|---|---|
Files/add(url='x.docx',overwrite=true) on the same name |
unchanged (new version) | opens the file |
…/moveto(newurl='…/y.docx',flags=1) |
unchanged | opens the renamed file |
recycle x.docx, upload y.docx |
new | broken |
Two link shapes, both survive the rename:
- Organization / specific-people link (
/:w:/s/site/<token>) – resolved via/_api/v2.0/shares/u!<base64url>/driveItem, which returned the new file name after the rename. - People with existing access (
/:b:/r/sites/site/Library/<old path>?d=w<UniqueId-without-dashes>&…) – even though it carries the old path, opening it after the rename redirected toDoc.aspx?sourcedoc={UniqueId}with the new name. Thed=parameter wins over the path.
Who can create which link
A user with read-only access (custom level without Manage Permissions) on a library where member sharing is off:
- the Copy link button in the library still works and produces a people with existing access link – it grants nothing new, so it is allowed;
ListItemAllFields/ShareLinkwithlinkKind: 2(organization view) → 403;linkKind: 1(Direct) → 400 "LinkKind cannot be Direct or Uninitialized";/_api/v2.0/…/createLinkcalled with the browser session → 403 "OAuth only flow is enabled and the call has not been issued from an app", whatever the scope.
So if your solution relies on people linking published documents to each other, the existing access link is the one they will have – and it survives a rename as long as the item stays the same.