How to Fix Document ID Links & Copy Links After Migration

Last updated: 2026-10-14

Step-by-step guide to identifying and fixing broken Document ID redirects and Copy Link (durable) URLs after a SharePoint migration using the Item Inventory Report and wildcard find & replace rules.

Overview

When SharePoint sites are migrated to a new tenant or restructured within the same tenant, Document ID links and Copy Link (durable link) URLs often break. These links reference documents by an internal identifier rather than a physical file path, and after migration the original identifiers may no longer resolve.

This guide shows how to:

  1. Identify broken links — Document ID redirects and Copy Link URLs embedded in your content.

  2. Map old identifiers to new file paths — Using the Item Inventory Report to export Document IDs, Item GUIDs, and physical file URLs.

  3. Create find & replace rules — Using Wildcard (or Regex) match type to replace broken identifier-based links with the correct physical paths in the new environment.

Tip: Always run your job with Flag Only turned on first. This shows a preview of all replacements in the report without making any actual changes.

Understanding the Problem

Document ID Links

SharePoint Document IDs assign a persistent identifier to every document. Links using Document IDs look like:

https://old-tenant.sharepoint.com/sites/hr/_layouts/15/DocIdRedir.aspx?ID=HRDOC-1234-5678
https://old-tenant.sharepoint.com/sites/finance/_layouts/15/DocIdRedir.aspx?ID=FINDOC-2024-0042

The Document ID format is configurable per site collection — common patterns include HRDOC-####-####, PROJX-######, or default alphanumeric IDs like MSDOC-XXXXXXXX.

After migration, the DocIdRedir.aspx page on the old tenant either no longer exists or cannot resolve the ID in the new environment.

Copy Link (Durable Link) URLs

When users click Copy Link in SharePoint, the generated URL typically includes the item's unique GUID:

https://old-tenant.sharepoint.com/sites/projects/_layouts/15/Doc.aspx?sourcedoc={3f2504e0-4f89-11d3-9a0c-0305e82c3301}&action=edit
https://old-tenant.sharepoint.com/:w:/s/projects/EWBFLz-JT9MamgwDBegsMwEBkl2oJ5FMsE?e=abc123

These links use the sourcedoc GUID or an encoded item identifier. After migration, the GUID may no longer resolve if the item was recreated rather than moved.

Step 1: Run an Item Inventory Report

Before you can fix broken links, you need a mapping from old identifiers to new physical file paths. The Item Inventory Report provides this.

Fixing Copy Link Paths (that use Item GUIDs) OR when fixing Document Ids, where the New Environment does NOT have the Matching Document Ids - run Item Inventory on source environment

If the new/target/destination environment does not have the Document ID values migrated from the source environment, then you must run the Item Inventory report on the source environment to be able to match the Document Id/Item GUID to the original paths.

Configure the Report

  1. Create a new Item Inventory job targeting the environment where files will match the Document ID / Item GUID in Copy Link path. Select the site(s) that may contain the document.

  2. In the Job Options, locate the Additional Fields section.

  3. Add the field(s) you need:

Broken Link Type

Additional Field to Add

Document ID links (DocIdRedir.aspx?ID=...)

Document Id

Copy Links with GUIDs (sourcedoc={...})

*(Item GUID is included by default)*

  1. Run the report.

What the Report Gives You

The completed report will contain columns including:

Item URL (Physical Path)

Document Id

Item GUID

https://tenant.sharepoint.com/sites/projects/proj-123/doc1.docx

PROJX-1234-5678

3f2504e0-4f89-11d3-9a0c-0305e82c3301

https://tenant.sharepoint.com/sites/projects/proj-123/report.pdf

PROJX-9012-3456

7a1b2c3d-4e5f-6789-abcd-ef0123456789

https://tenant.sharepoint.com/sites/hr/policies/handbook.docx

HRDOC-2024-0001

a1b2c3d4-e5f6-7890-abcd-ef1234567890

If this report was from the source environment, we need to now find the new lists/libraries that the files were migrated to obtain the NEW PATH.
For example, https://tenant.sharepoint.com/sites/projects/proj-123/doc1.docx has the site:
https://tenant.sharepoint.com/sites/projects/
which may have been migrated to (New physical path) https://new-tenant.sharepoint.com/sites/projects/

You now have the mapping:

  • Document ID → New physical path

  • Item GUID → New physical path

Step 2: Create Find & Replace Rules

Use the report data to build your find & replace rules. Each broken link gets a rule that matches the old identifier and replaces the entire URL with the new physical path.

Fixing Document ID Links

For each row in your inventory report, create a rule:

Field

Value

Old Value

*PROJX-1234-5678*

New Value

https://new-tenant.sharepoint.com/sites/projects/proj-123/doc1.docx

Match Type

Wildcard

Replacement Behavior

Partial Match OR Completely Replace

  • The * already handles the entire match to replace, so either partial match or completely replace will work.

Why this works: The wildcard *PROJX-1234-5678* matches any URL that contains the Document ID — regardless of the tenant, site path, or DocIdRedir.aspx URL structure surrounding it. The entire matched URL is then replaced with the direct file path.

Example — Multiple Document ID Rules

Old Value

New Value

Match Type

*PROJX-1234-5678*

https://new-tenant.sharepoint.com/sites/projects/proj-123/doc1.docx

Wildcard

*PROJX-9012-3456*

https://new-tenant.sharepoint.com/sites/projects/proj-123/report.pdf

Wildcard

*HRDOC-2024-0001*

https://new-tenant.sharepoint.com/sites/hr/policies/handbook.docx

Wildcard

Fixing Copy Link / Durable Link URLs

For GUID-based links, use the Item GUID from the inventory report:

Field

Value

Old Value

*3f2504e0-4f89-11d3-9a0c-0305e82c3301*

New Value

https://new-tenant.sharepoint.com/sites/projects/proj-123/doc1.docx

Match Type

Wildcard

Replacement Behavior

Partial Match OR Completely Replace

  • The * already handles the entire match to replace, so either partial match or completely replace will work.

Why this works: Copy Link URLs always contain the item GUID somewhere in the URL (either as a sourcedoc parameter or encoded in the path). The wildcard *{guid}* matches the full URL regardless of the surrounding structure.

Example — Multiple GUID Rules

Old Value

New Value

Match Type

*3f2504e0-4f89-11d3-9a0c-0305e82c3301*

https://new-tenant.sharepoint.com/sites/projects/proj-123/doc1.docx

Wildcard

*7a1b2c3d-4e5f-6789-abcd-ef0123456789*

https://new-tenant.sharepoint.com/sites/projects/proj-123/report.pdf

Wildcard

*a1b2c3d4-e5f6-7890-abcd-ef1234567890*

https://new-tenant.sharepoint.com/sites/hr/policies/handbook.docx

Wildcard

Step 3: Import Rules from Excel

When you have many broken links to fix, manually adding rules is impractical. Instead, build your rules in Excel and import them.

Building the Excel File

Using your Item Inventory report as a data source, construct an Excel file with:

Column A (Old Value)

Column B (New Value)

Column C (Match Type)

*PROJX-1234-5678*

https://new-tenant.sharepoint.com/sites/projects/proj-123/doc1.docx

Wildcard

*PROJX-9012-3456*

https://new-tenant.sharepoint.com/sites/projects/proj-123/report.pdf

Wildcard

*3f2504e0-4f89-11d3-9a0c-0305e82c3301*

https://new-tenant.sharepoint.com/sites/projects/proj-123/doc1.docx

Wildcard

Workflow to build this file:

  1. Export or copy the Item Inventory report to Excel.

  2. In Column A, wrap each Document ID or GUID with * on both sides — e.g., *PROJX-1234-5678*.

  3. In Column B, paste the Item URL (physical path) from the inventory report.

  4. In Column C, enter Wildcard for all rows.

  5. Import the file into your Link Find & Replace job.

Step 4: Run the Link Job

  1. Target the destination sites — Run the Link Find & Replace job against the sites in your new environment where content contains the broken links.

  2. Enable Flag Only — On the first run, enable Flag Only to preview all matches without making changes.

  3. Review the report — Verify that the correct links are being matched and the replacement values are correct.

  4. Run with changes enabled — Once satisfied, disable Flag Only and run again to apply the replacements.

Advanced: Using Regex for Pattern-Based Replacement

If your Document IDs follow a predictable pattern and the site structure is preserved, you can use Regular Expression match type to handle many links with a single rule instead of one rule per document.

For detailed regex syntax, capture groups, and advanced matching techniques, see: How to Use Wildcard & Regex in Link Find & Replace.

Example: Redirect All Document ID Links from One Site

If you just need to redirect all Document ID links from an old site to a landing page or library:

Field

Value

Old Value

*old-tenant.sharepoint.com/sites/hr/_layouts/15/DocIdRedir.aspx*

New Value

https://new-tenant.sharepoint.com/sites/hr/Documents

Match Type

Wildcard

Replacement Behavior

Partial Match OR Completely Replace

  • The * already handles the entire match to replace, so either partial match or completely replace will work.

Example: Regex to Preserve the Document ID in the New URL

If the new environment still supports Document IDs but on a different tenant/site:

Field

Value

Old Value

https://old-tenant\.sharepoint\.com/sites/\w+/_layouts/15/DocIdRedir\.aspx\?ID=(.+)

New Value

https://new-tenant.sharepoint.com/sites/hr/_layouts/15/DocIdRedir.aspx?ID=$1

Match Type

Regular Expression

Replacement Behavior

Partial Match (Do not use Completely replace, it will not work)

This captures the Document ID value and rewrites the URL to point to the new tenant while preserving the original ID.

Tips & Best Practices

  1. Always use Flag Only first. Verify that your wildcard patterns match the intended links and nothing else.

  2. Run Inventory on the destination. The Item Inventory Report should target the new environment so you get the current physical paths for your New Values.

  3. GUIDs are case-insensitive. Wildcard matching is case-insensitive, so *3F2504E0* and *3f2504e0* both match.

  4. One rule per document. When fixing identifier-based links, each unique Document ID or GUID needs its own rule mapping to the specific file path.

  5. Use Excel import for bulk rules. For migrations with hundreds or thousands of documents, build your rule set in Excel using the inventory report data.

  6. Combine Document ID and GUID rules. You can include rules for both Document ID links and Copy Links in the same job — each rule has its own match type.

  7. Handle URL-encoded GUIDs. Some Copy Link URLs encode the GUID with %2D instead of -. The wildcard pattern *3f2504e0* will still match if enough of the GUID is unencoded, but you may need to add a second rule with the encoded form if needed.

  8. Check for both link types. A single document may be referenced by both a Document ID link and a Copy Link in different locations — ensure you create rules for both.