When you share a file in SharePoint with an external user, the link sometimes opens a different file than the one you intended. This issue typically occurs because SharePoint resolves the link based on the file name rather than its unique ID, and renaming or moving files can break the intended mapping. This article explains why external sharing links point to the wrong file and provides a step-by-step fix to restore correct access.
Key Takeaways: Fixing External Sharing Links That Open the Wrong File
- SharePoint admin center > Sharing > File and folder links: Controls whether links use file IDs or names; set to “Specific people” and choose “Can view” to reduce link breakage.
- File version history: Restoring a previous version can re-link the shared URL to the correct file if the file was overwritten.
- Site Collection > Site settings > Site collection features > SharePoint Server Publishing: Enabling this feature can improve link stability by using unique IDs instead of file paths.
Why SharePoint External Sharing Links Open the Wrong File
SharePoint generates external sharing links using a combination of the site URL, the document library path, and the file name. When you share a file, the link points to the file’s current location. If the file is later renamed, moved to a different folder, or replaced with a new version that has the same name, the link may resolve to the wrong file because SharePoint sees the file name as the primary identifier.
Another common scenario involves file versioning. If a user uploads a new version of the same file, the sharing link still points to the file ID, but the ID may be reassigned if the file is deleted and re-uploaded. In shared libraries where multiple files share similar names, the link can accidentally open a sibling file with a matching prefix.
The root cause is that external sharing links are not permanently tied to a unique internal identifier by default. SharePoint uses a relative URL path, and any change to that path breaks the link’s intended target. This behavior is by design for backward compatibility but causes confusion for external users who receive a link that opens an unrelated document.
File Rename and Move Operations
When you rename a file in SharePoint, the system updates the URL path. However, any previously shared external link still contains the old file name. If another file exists with the old name, the link will open that file instead. Moving a file to a different library or site also invalidates the URL path, causing the link to fail or redirect to a different file.
File Version Overwrites and Deletion
If a file is deleted and a new file is uploaded with the same name, the new file receives a new internal ID. External links created before the deletion still point to the old ID, which no longer exists. SharePoint then attempts to resolve the link by file name, which may match the new file, but the ID mismatch can cause the wrong file to open.
Steps to Fix External Sharing Links That Open the Wrong File
- Identify the original file name and location
Open the site where the file was originally shared. Go to the document library and check the file that the external link should open. Note the exact file name and the folder path. If the file was moved or renamed, you need to restore the original name or move it back. - Check version history for the intended file
Select the file and click the ellipsis (…) to open the context menu. Choose Version history. Look for the version that was active when the sharing link was created. If the file was overwritten, restore that version by clicking the down arrow next to the version and selecting Restore. This re-links the file ID to the correct content. - Rename or move the file back to its original location
If the file was renamed, rename it back to the exact name used when the link was shared. If it was moved, move it back to the original folder. After restoring the original path, test the external link by opening it in a private browser window. - Create a new external sharing link
If the original link still opens the wrong file, generate a new link. Select the file, click Share, and choose Copy link. Set the link type to Specific people and permission to Can view. Send this new link to the external recipient. Delete the old link by going to Manage access for the file and removing the expired link. - Enable unique ID-based sharing in the site collection
Navigate to Site settings > Site collection features. Activate SharePoint Server Publishing. This feature forces SharePoint to use internal file IDs for links rather than file names. After activation, any new sharing links will be more stable. Note that this does not fix existing broken links.
If SharePoint Still Has Issues After the Main Fix
External Sharing Link Opens a Different Library
If the link opens a file in a different document library, the original file may have been moved to that library. Use the Go to location option in the file’s context menu to see the current path. Move the file back to the original library and test the link again.
External User Receives a Blank Page or Error
A blank page usually means the file was deleted permanently. Check the site’s Recycle Bin or Second-stage recycle bin in the site settings. Restore the file to its original location. If the file is not in the recycle bin, you may need to restore from a backup or recreate the file with the exact same name.
Link Works but Shows a Different Version
This happens when the file was updated after the link was shared. The external link always opens the latest version unless you use a specific version link. To share a specific version, open the file, go to Version history, click the down arrow on the version you want, and select Copy link. Use that link for external sharing.
External Sharing Link Types: File ID vs File Name
| Item | File ID-based link | File name-based link |
|---|---|---|
| Description | Uses a unique internal GUID to identify the file | Uses the file name and folder path in the URL |
| Stability after rename | Link still works because the ID does not change | Link breaks or opens a different file with the old name |
| Stability after move | Link still works because the ID is independent of location | Link breaks because the URL path changes |
| Requires SharePoint Server Publishing | Yes, to enable ID-based links for external sharing | No, works by default |
| Best for | Files that are frequently renamed or moved | Static files with permanent names and locations |
To check which type your site uses, open any file and look at the sharing link URL. If the URL contains a GUID (a long string of letters and numbers), it is ID-based. If it contains the file name, it is name-based. You can change the behavior by enabling or disabling the SharePoint Server Publishing feature at the site collection level.
After you apply the fix, test the external link from a browser that is not logged into your organization. Use an incognito or private window to simulate an external user’s experience. If the link still opens the wrong file, repeat the steps and verify that the file name and location match exactly what was used when the link was created.