Checking for broken links in SharePoint

By:   |   Comments   |   Related: > SharePoint


Problem

Broken links annoy users by wasting their time. Links can break because of errors when they were entered, or because the page or file they pointed to gets removed.

If you want to attract and retain visitors with a quality experience, you need to make sure that your site does not have any broken links, not only when it is first published but at regular intervals. But there is no function in SharePoint to check a site for broken links.

Solution

That wonderful tool, SharePoint Designer, has just what you need.

Just as with any web site, it is important to make sure that you don't have broken links in a SharePoint site. It is very frustrating for a user to click on a link, wait around while the browser tries to find something, then end up with a (usually unhelpful) error page.

SharePoint does provide some assistance compared to a normal web site. For example, if you rename a file, SharePoint will often fix up links within the site collection automatically. However, it may not fix all links, and it will not help with links outside the site collection.

You may have noticed in Central Administration in MOSS that there is an option called Site Directory Links Scan. This will scan views of a site directory for broken links, and even update the title and description of sites in the directory if they have been changed in the site. However, this function is unfortunately not available for general use outside of a site directory. (Note also that the site directory function in MOSS has been deprecated in SP2010.)

Fortunately, SharePoint Designer has inherited some very nice link management functionality from its predecessor product FrontPage. And you certainly can't complain about the price: SharePoint Designer is available as a free download - see Download details: SharePoint Designer 2007.

Checking links in MOSS 2007

Using SharePoint Designer 2007, you can view the incoming and outgoing links for any page in a diagram. At the bottom of the Web Site pane in the middle, select the Hyperlinks option. You will then be prompted to select a page from the Folder List on the left.

sharepoint designer

You can also view reports on all the links in the site. At the bottom of the Web Site pane, select Reports.

web site

There are options to view all hyperlinks, unverified links, broken links, external links and internal links. If you select one of the links reports, SPD will offer to check the links for you. Be aware that this can take a while in a large site, particularly if there are a large number of external links.

Prompt to check for broken links
Broken links report

If you right click anywhere in the report, you have the option Copy Report. You can then paste a copy of the report as a table into an Excel spreadsheet or Word document.

So what about SharePoint 2010?

Unfortunately, in SharePoint Designer 2010 much of the reporting functionality inherited from FrontPage has been deprecated (see Discontinued features in SharePoint Designer 2010 - SharePoint Designer - Microsoft Office). This is part of the general move to eliminate non-SharePoint-specific features (see SharePoint Designer 2010 Limitations). And no, you can't use SharePoint Designer 2007 with SharePoint 2010 sites.

SharePoint 2010 has lost the hyperlinks diagram and the various hyperlinks reports; at least, I can't find them - if you can, please leave a comment! Fortunately though, the basic link check and fix functionality in the page editor has been retained, and this can still be used to check links across a complete site.

Fixing hyperlinks

To get to this function in either SharePoint Designer 2007 or 2010, you have to open a page in the editor. So, select a page in the site and open it. As always, if you select a page linked to a page layout on a publishing site, you will be prompted to open the attached page layout. If prompted, don't check out the page or page layout (unless you actually intend to modify it).

In SharePoint Designer 2007, select Hyperlinks from the Task Panes menu. In SharePoint Designer 2010, in the page editor, select the View tab, then from the Task Panes drop-down, select Hyperlinks.

SharePoint Designer task panes menu

By default, it will only show external hyperlinks. If you want to see internal links as well, select the bottom icon on the left.

Option to show internal hyperlinks

You can then use the check option at the top on the left to verify the hyperlinks.

Verify hyperlinks dialog with options to verify unknown or all links
Screen showing all links OK

If you can see a hyperlink that needs to be fixed or changed, right click it and select Edit Hyperlink...

Edit hyperlink dialog

You have the ability to fix a hyperlink that is used in many pages in one operation. Note that you will prompted if required to check out pages to be modified, and you will need to check them back in again when finished.

Next Steps
  • Download the appropriate version of SharePoint Designer for the version of SharePoint you are using (remember, it's free!).
  • Use it to regularly to check that all the links in your site work.


sql server categories

sql server webinars

subscribe to mssqltips

sql server tutorials

sql server white papers

next tip



About the author
MSSQLTips author Knox Cameron Knox Cameron

This author pledges the content of this article is based on professional experience and not AI generated.

View all my tips



Comments For This Article

















get free sql tips
agree to terms