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:
Identify broken links — Document ID redirects and Copy Link URLs embedded in your content.
Map old identifiers to new file paths — Using the Item Inventory Report to export Document IDs, Item GUIDs, and physical file URLs.
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-0042The 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=abc123These 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
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.
In the Job Options, locate the Additional Fields section.
Add the field(s) you need:
Broken Link Type | Additional Field to Add |
|---|---|
Document ID links ( |
|
Copy Links with GUIDs ( | *(Item GUID is included by default)* |
Run the report.
What the Report Gives You
The completed report will contain columns including:
Item URL (Physical Path) | Document Id | Item GUID |
|---|---|---|
|
|
|
|
|
|
|
|
|
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 |
|
New Value |
|
Match Type | Wildcard |
Replacement Behavior | Partial Match OR Completely Replace
|
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 |
|---|---|---|
|
| Wildcard |
|
| Wildcard |
|
| Wildcard |
Fixing Copy Link / Durable Link URLs
For GUID-based links, use the Item GUID from the inventory report:
Field | Value |
|---|---|
Old Value |
|
New Value |
|
Match Type | Wildcard |
Replacement Behavior | Partial Match OR Completely Replace
|
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 |
|---|---|---|
|
| Wildcard |
|
| Wildcard |
|
| 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) |
|---|---|---|
|
| Wildcard |
|
| Wildcard |
|
| Wildcard |
Workflow to build this file:
Export or copy the Item Inventory report to Excel.
In Column A, wrap each Document ID or GUID with
*on both sides — e.g.,*PROJX-1234-5678*.In Column B, paste the Item URL (physical path) from the inventory report.
In Column C, enter
Wildcardfor all rows.Import the file into your Link Find & Replace job.
Step 4: Run the Link Job
Target the destination sites — Run the Link Find & Replace job against the sites in your new environment where content contains the broken links.
Enable Flag Only — On the first run, enable Flag Only to preview all matches without making changes.
Review the report — Verify that the correct links are being matched and the replacement values are correct.
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 |
|
New Value |
|
Match Type | Wildcard |
Replacement Behavior | Partial Match OR Completely Replace
|
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 |
|
New Value |
|
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
Always use Flag Only first. Verify that your wildcard patterns match the intended links and nothing else.
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.
GUIDs are case-insensitive. Wildcard matching is case-insensitive, so
*3F2504E0*and*3f2504e0*both match.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.
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.
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.
Handle URL-encoded GUIDs. Some Copy Link URLs encode the GUID with
%2Dinstead 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.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.