A client recently told me that even though I had urged her to use “Copy link” with “People with existing access” to make a link to a document on a SharePoint communication site, she had determined that selecting the Path to the document was better — because links didn’t break when documents were renamed. I did some testing, saw someting different than she was seeing, and concluded … that we were both right!
When we got together to compare why we saw different results, as I expected, there was something different about what we were doing. It turns out, we were not testing with the same type of document or browser. I was surprised to learn some new SharePoint link superpowers, but was concerned because as it turns out, choosing the right way to grab a link to a document depends on multiple things. Fortunately, you don’t have to remember all of the use cases we tested, because there is a simple approach that will work consistently to provide the best user experiences.
Specifically, we found that link behavior is based on:
- Browser (Edge vs. Chrome)
- Web part (Quick Links vs. Text hyperlink)
- Type of document (PDF vs. native Office file)
- Location (site where the document lives and where you are making the link)
The scenarios are complex and nuanced, but here is the bottom line.
On your site, use the Quick Links web part if you can. For any type of file, use the Quick Links web part to navigate to the file and add a link to the file if it lives on your site. (Be careful when you are using the Quick Links web part. If you upload a document from that web part, you may not be able to easily find it again because it will be stored in Site Assets – in a folder with the same name as the page title. It will not “live” in the Documents library, which is where editors and others might expect to find it. I always recommend that you upload your documents to the library or folder where you want to maintain them first. After you upload the file, use the Quick Links web part to navigate to the file.)
Why use this approach? If you move or rename the file, your links will not break!
For native Office files, use Copy link > people with existing access can use the link to copy a link to a document and add it to either a text hyperlink or Quick Links web part. It doesn’t matter whether you use Share vs. Copy Link; both methods give you the exact same experience. But it’s a little more work to use Share unless you are trying to send a link to a file via email. If you just want to make a link to a file, use Copy link. If you want to email a link, Share saves some steps.
Why use this approach? If you move or re-name a document and you have used this type of link, your document links will not break. (The same is true if you are linking to the documents from another site!)
For PDF files, copy the path to the document and add it to either a text hyperlink or Quick Links web part. You can find the Path link by clicking the information panel for the document, scrolling down to the bottom of the attributes, and clicking the icon next to the Path.
Why use this approach? If you move or rename the file, your link will not break if you are on the same site, but they will break if you are linking from another site.
For pages, the experience is the same in both Chrome and Edge. Renaming the Title of a page does not affect the URL for the page. So, Title updates will not affect links to the page. The only action that affects links is renaming the file name for the page. You can rename the Title of a page without renaming the page URL. Unless there is a major disconnect between the Title and the file name for the page, you may want to limit changes to the file name for pages.
For pages, use the Path to create links. The quickest way to get the path is to open the page and grab the URL. However, you can also get the path from the Site Pages library using the same method as if you were getting the path to a file.
Why use this approach? Links to the page in navigation or web parts on your site will not break if the file name is changed. However, all links from other sites to the page will break if the file name is changed.
Other web parts
These experiences are not browser-dependent. I’ll explain the implications in the recommendations below:
Link to a file using the File Viewer web part
- Select the file from the web part if the file lives on your site. If you choose an Office file or PDF from the web part, you can rename and move the file within the site and your link will still work.
- If you are displaying a file on another site, you can choose either the Path or Copy Link for any type of document. Both links will resolve to the new name or location if you rename or move the document within the source site.
Link to a view of a Document Library
- Document Library web part on your site. You can rename the view URL or Title of the view and your web part will still work.
- Quick Links web part. You can rename the view URL or Title of the view and your web part will still work.
- Links to a view on another site. Changing the Title of your view will not affect the link. If you change the view URL, the link will break.
Want all the details?
I’ve created detailed tables that explain all the different browser, web part, and link type scenarios. To explore, review my document “Linking to Files and Pages in SharePoint Online.”