SummaryLinks webpart and outgoing links

16 Jun

At a client I worked on migrating content from Tridion to SharePoint 2010. Data included links that had to be migrated to links in a SummaryLinks webpart.
For another feature of the project the outgoing links of a page were used to do something with it. After migrating the content to a SummaryLink webpart the code of the feature mentioned there were no outgoing links on the page. The SharePoint Content and Structure can show Related Resources on a page, which includes outgoing links. This overview didn’t show the links either.

Figure 1 – SummaryLinks webpart with some links

Figure 2 – No outgoing links shown in the overview

After editing the page by making some changes to the SummaryLinks webpart the outgoing links started to appear in the Content and Structure overview.

Figure 3 – Outgoing links are shown

At this point is was obvious SharePoint did something to the webpart when modifying it from the UI, which was missing or didn’t fire when adding the webpart with links from code.

Time to start SharePoint Manager to see what’s going on by comparing the settings of two summarylinks webparts: one which was added programmatically and one which was fully configured by the UI.

Figure 4 – Webpart on the left was added programmatically, on the right configured by UI

The first thing I did was comparing the xml of the two webparts. There were some changes, but these were related to the fact the webparts were placed in another webpart zone, had another title and another link set.

The next thing was to put two windows in SharePoint Manager next to each other and do some comparison of the properties set. After some quick scrolling I noticed the ManagedLinkHash was populated with a GUID at the webpart which was configured from the UI and this property was empty at the webpart which was programmatically added to the page. Besides the difference at the ManagedLinkHash property also the ManagedLinks collection was different between the two webparts: The collection was empty for the webpart added programmatically to the page.

Figure 5 – Properties of webpart (configured in UI) in SharePoint Manager

Figure 6 – Properties of webpart (added programmatically) in SharePoint Manager

These two properties are internally used by SharePoint to determine changes in the link targets of the SummaryLinks webpart.
The ManagedLinkHash is a hash of the saved ManagedLinks links and is used to quickly determine if the ManagedLinks have been modified by the system since the last time that they were saved, quite neat actually.
The ManagedLinks property stores the url’s of the SummaryLinks (stored in the SummaryLinkStore property) so they can be updated by the Web Part framework if the link targets move within the SharePoint site.
The code to add the links to the SummaryLinks webpart including setting the ManagedLinks property:

SummaryLink link = new SummaryLink("IT-Idea");
link.LinkUrl = "";
SummaryLink linkwithinSP = new SummaryLink("Lorem txt");
linkwithinSP.LinkUrl = "http://sp2010/Documents/lorem.txt";
SummaryLinkFieldValue sumlinks = new SummaryLinkFieldValue();
wp.SummaryLinkValue = sumlinks;

//add the links to the managedlinks array for automatic link updates by SharePoint
foreach (SummaryLink item in sumlinks.SummaryLinks)

The ManagedLinkHash is generated of the links added to the SummaryLinks webpart.

The result on the page stays the same, but the Content and Structure and SharePoint Manager will display the links correctly:

Figure 7 – Related resources overview in Content and Structure shows links

Figure 8 – Properties in SharePoint Manager show links

When the document will be moved to another library:

Figure 9 – Moving a document to another location

The ManagedLinkHash, ManagedLinks and the SummaryLink will be instantly updated.
SummaryLink change can be seen in the Content and Structure overview:

Figure 10 – Link changes shown

The changes to the ManagedLinkHash and ManagedLinks properties can be seen in SharePoint Manager:

Figure 11 – SharePoint Manager view


Sharepoint keeps administration about the linked objects in the SummaryLinks webpart. Make sure you do to!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.