Detect broken links in documents - Sharepoint online migration

Copper Contributor

Hi everyone,

 

I am migrating several sites from sharepoint on-premises to sharepoint online, however in some document libraries I have different types of documents (docx, pdf, xlsx...) with urls to old sites in sharepoint on-premises. 

 

I am search for a solution, but until now seems that only with a third party tool I can do that. For example, Cognillo is a nice tool but very expensive.

 

My question is if it there is a solution provided by microsoft to solve this, for example any kind of powershell script or if there is another third party tool to solve this problem?

 

Thanks

9 Replies

@Andre_Silva 

Let's start by ruling out the obvious.  How are you migrating?  It's possible that your current tool may have something that can do this for you.

I don't think so. You'll have to look at third party tools like the one you mentioned above.
Another thing you need to consider are the external references in Excel formulas.

@Steven Andrews unfortunately not. I am using Sharegate and at this moment doesn't have this feature. I checked it.

@Andre_Silva 
You basically have 2 problems:
a. migrated documents that contain links that are broken because of the migration
b. links from external places (emails, bookmarks, documents in other systems, ...) that refer to the old SharePoint location.

Addressing problem a is not extremely hard. Use tools to replace the links within the migrated documents. It may cost some $'s but you will get an acceptabel result. Do check if the 3rd tools also change the modify date. If that has been retained as part of the migration you do not want to change these dates when fixing the links. I am not aware of PS scripts with this capability. 

Problem b is much more challenging. These links will persist for years to come. One way to overcome this is by migrating documents plus their original url's to the new SharePoint system and then make the original url's searchable. Also automatically redirect traffic to the old locations to the search page.
(Interesting topic though. Something to give proper priority in our roadmap.)
Paul

@Paul de Jong 

According our organization, problem a) is the most relevant. We have many official documents with link to other documents or folders, and we must to update this links. 

It will be good with the improvement of Microsoft migration tool this feature should also be included. 

 

Inspired by the code found here, here and here, I created this file in C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\CONTROLTEMPLATES\WikiMiniConsole.ascx

<%@ Control Language="C#" AutoEventWireup="false" %>
<%@Assembly Name="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@Register TagPrefix="SharePoint" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" namespace="Microsoft.SharePoint.WebControls"%>
<%@Register TagPrefix="SPHttpUtility" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" namespace="Microsoft.SharePoint.Utilities"%>
<%@ Register TagPrefix="wssuc" TagName="ToolBar" src="~/_controltemplates/ToolBar.ascx" %>
<%@ Register TagPrefix="wssuc" TagName="ToolBarButton" src="~/_controltemplates/ToolBarButton.ascx" %>

<SharePoint:RenderingTemplate ID="WikiMiniConsole" runat="server">
<Template>
<div style="position:relative;top:0;left:0;">
<div class="ms-wikieditouter">
<table id="miniconsole" cellspacing="0" cellpadding="0" border="0" width="100%"><tr><td>
<table class="ms-wikieditsecond" cellspacing="0" cellpadding="0" border="0" width="100%"><tr><td>
<table class="ms-wikieditthird" cellspacing="0" cellpadding="0" border="0" width="100%"><tr><td>
<!-- this is for the orange cast inside the menu -->
<table class="ms-wikieditorange" cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td class="ms-wikieditorangeinnera" style=";width:100%;">&nbsp;</td>
</tr>
<tr><td>
<wssuc:ToolBar CssClass="ms-wikitoolbar" runat="server">
<Template_Buttons>
<SharePoint:WikiEditItemButton Text= "<%$Resources:wss,siteactions_wikieditpage%>" runat="server"/>
<SharePoint:WikiPageHistoryButton Text= "<%$Resources:wss,siteactions_viewpagehistory%>" ButtonID="WikiPageHistory" runat="server"/>
<SharePoint:WikiIncomingLinksButton Text= "Incoming Links" ButtonID="WikiIncomingLinks" runat="server"/>
</Template_Buttons>
</wssuc:ToolBar>
</td></tr></table>
</td></tr></table>
</td></tr></table>
</td></tr></table>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js" type="text/javascript"> </script>
<script type="text/javascript">
$(function() {

var toc = "<div id='toc' style='background:#EBF3FF;"
+"border:1px solid #6F9DD9;display:none;"
+"position:absolute;top:127;right:11;width:250px;"
+"text-align:left;'></div>";

$("td.ms-bodyareaframe:first").append(toc);

//get the url for the incoming links page
u = $("a[id$=WikiIncomingLinks_LinkText]")[0].href;

//get the target container and load it with the incoming links
//filtered to show the links list only
$("#toc").load(u + " .ms-propertysheet");

$("#toc").wrapInner("<ul style='padding:2px;margin:0;list-style-type:none;'></ul>");
$("#toc a").wrap("<li style='padding:0;margin:0;'></li>");
$("#toc li").prepend("<img style='margin-right:5px;' alt='' src='/_layouts/images/square.gif'/>");
$("#incominglinks").click(function(){
$("#toc").toggle();
});

// override the target of our hyperlink to bring up the menu
$("#ctl00_PlaceHolderMiniConsole_ctl00_ctl00_ctl00_RptControls_WikiIncomingLinks_LinkText").attr("href", "#")
$("#ctl00_PlaceHolderMiniConsole_ctl00_ctl00_ctl00_RptControls_WikiIncomingLinks_LinkText").click(function(){
$("#toc").toggle();
});
});
</script>

 

</div></div>
</Template>
</SharePoint:RenderingTemplate>

 

I hope this helps you with broken links on Sharepoint online migration.

@Steven Andrews 

 

Hello,

 

I need to regularly check my sites for dead links within SharePoint Online. I created my tool and decided to share it. https://blog.p-difm.com/sharepoint-online-check-for-broken-links/

 

Glad if it helps :smile:

 

Yann

@Andre_SilvaThere are also other tools doing the same job like Cognillo that you mentioned but are more affordable.

 

My tool is ReplaceMagic (www.replacemagic.com) where identification of links in documents, SharePoint pages (hard coded links, Wiki or Canvas pages), list item field of URL type and coming Web Parts is free. In case that you want to fix links that is chargeable but ReplaceMagic licenses does not have limitations on number of sites or documents or link except to number of users/computers where tool is used. Also RM licenses are perpetual.

Of course, we can keep document metadata (last modified date or last modified by).

At the end, I doubt that with scripts you'll be able to come to functionality that is provided by tools similar to ReplaceMagic.

 

BR,

Oliver

Chrome offers extensions to detect broken links in a site collections. The extension works really good at detecting broken links. But it wont detect broken links within web parts, leading to the conclusion that the user will have to run the extension in each of the web parts within the site collection.