{"id":1537,"date":"2013-06-16T14:34:27","date_gmt":"2013-06-16T12:34:27","guid":{"rendered":"http:\/\/www.itidea.nl\/?p=1537"},"modified":"2013-06-16T14:35:03","modified_gmt":"2013-06-16T12:35:03","slug":"summarylinks-webpart-and-outgoing-links","status":"publish","type":"post","link":"https:\/\/www.itidea.nl\/index.php\/summarylinks-webpart-and-outgoing-links\/","title":{"rendered":"SummaryLinks webpart and outgoing links"},"content":{"rendered":"<p>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.<br \/>\nFor 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&#8217;t show the links either.<br \/>\n<a href=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2013\/06\/OutgoingLinksSummaryWPOnPageFromCode_01.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1547\" title=\"OutgoingLinksSummaryWPOnPageFromCode_01\" src=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2013\/06\/OutgoingLinksSummaryWPOnPageFromCode_01.png\" alt=\"\" width=\"340\" height=\"188\" srcset=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2013\/06\/OutgoingLinksSummaryWPOnPageFromCode_01.png 485w, https:\/\/www.itidea.nl\/wp-content\/uploads\/2013\/06\/OutgoingLinksSummaryWPOnPageFromCode_01-300x165.png 300w\" sizes=\"auto, (max-width: 340px) 100vw, 340px\" \/><\/a><\/p>\n<h5>Figure 1 &#8211; SummaryLinks webpart with some links<\/h5>\n<p><a href=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2013\/06\/OutgoingLinksSummaryWPContentAndStructureResult_02.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1546\" title=\"OutgoingLinksSummaryWPContentAndStructureResult_02\" src=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2013\/06\/OutgoingLinksSummaryWPContentAndStructureResult_02.png\" alt=\"\" width=\"625\" height=\"222\" \/><\/a><\/p>\n<h5>Figure 2 &#8211; No outgoing links shown in the overview<\/h5>\n<p>After editing the page by making some changes to the SummaryLinks  webpart the outgoing links started to appear in the Content and  Structure overview.<\/p>\n<p><a href=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2013\/06\/OutgoingLinksSummaryWPContentAndStructureResult_041.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1554\" title=\"OutgoingLinksSummaryWPContentAndStructureResult_04\" src=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2013\/06\/OutgoingLinksSummaryWPContentAndStructureResult_041.png\" alt=\"\" width=\"624\" height=\"239\" srcset=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2013\/06\/OutgoingLinksSummaryWPContentAndStructureResult_041.png 891w, https:\/\/www.itidea.nl\/wp-content\/uploads\/2013\/06\/OutgoingLinksSummaryWPContentAndStructureResult_041-300x115.png 300w\" sizes=\"auto, (max-width: 624px) 100vw, 624px\" \/><\/a><\/p>\n<h5>Figure 3 &#8211; Outgoing links are shown<\/h5>\n<p>At this point is was obvious SharePoint did something to the webpart  when modifying it from the UI, which was missing or didn&#8217;t fire when  adding the webpart with links from code.<\/p>\n<p>Time to start SharePoint  Manager to see what&#8217;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.<\/p>\n<p><a href=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2013\/06\/OutgoingLinksSummaryWPOnPageFromCodeAndOneFromUI_03.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1545\" title=\"OutgoingLinksSummaryWPOnPageFromCodeAndOneFromUI_03\" src=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2013\/06\/OutgoingLinksSummaryWPOnPageFromCodeAndOneFromUI_03.png\" alt=\"\" width=\"693\" height=\"179\" srcset=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2013\/06\/OutgoingLinksSummaryWPOnPageFromCodeAndOneFromUI_03.png 990w, https:\/\/www.itidea.nl\/wp-content\/uploads\/2013\/06\/OutgoingLinksSummaryWPOnPageFromCodeAndOneFromUI_03-300x77.png 300w\" sizes=\"auto, (max-width: 693px) 100vw, 693px\" \/><\/a><\/p>\n<h5>Figure 4 &#8211; Webpart on the left was added programmatically, on the right configured by UI<\/h5>\n<p>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.<\/p>\n<p>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.<br \/>\n<a href=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2013\/06\/OutgoingLinksSummaryWPComparisonSPManager_05a.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1551\" title=\"OutgoingLinksSummaryWPComparisonSPManager_05a\" src=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2013\/06\/OutgoingLinksSummaryWPComparisonSPManager_05a.png\" alt=\"\" width=\"620\" height=\"361\" srcset=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2013\/06\/OutgoingLinksSummaryWPComparisonSPManager_05a.png 886w, https:\/\/www.itidea.nl\/wp-content\/uploads\/2013\/06\/OutgoingLinksSummaryWPComparisonSPManager_05a-300x174.png 300w\" sizes=\"auto, (max-width: 620px) 100vw, 620px\" \/><\/a><\/p>\n<h5>Figure 5 &#8211; Properties of webpart (configured in UI) in SharePoint Manager<\/h5>\n<p><a href=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2013\/06\/OutgoingLinksSummaryWPComparisonSPManager_05b.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1550\" title=\"OutgoingLinksSummaryWPComparisonSPManager_05b\" src=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2013\/06\/OutgoingLinksSummaryWPComparisonSPManager_05b.png\" alt=\"\" width=\"613\" height=\"361\" srcset=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2013\/06\/OutgoingLinksSummaryWPComparisonSPManager_05b.png 875w, https:\/\/www.itidea.nl\/wp-content\/uploads\/2013\/06\/OutgoingLinksSummaryWPComparisonSPManager_05b-300x176.png 300w\" sizes=\"auto, (max-width: 613px) 100vw, 613px\" \/><\/a><\/p>\n<h5>Figure 6 &#8211; Properties of webpart (added programmatically) in SharePoint Manager<\/h5>\n<p>These two properties are internally used by SharePoint to determine changes in the link targets of the SummaryLinks webpart.<br \/>\nThe 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.<br \/>\nThe ManagedLinks property stores the url&#8217;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.<br \/>\nThe code to add the links to the SummaryLinks webpart including setting the ManagedLinks property:<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\nSummaryLink link = new SummaryLink(&quot;IT-Idea&quot;);\r\nlink.LinkUrl = &quot;http:\/\/www.itidea.nl&quot;;\r\nSummaryLink linkwithinSP = new SummaryLink(&quot;Lorem txt&quot;);\r\nlinkwithinSP.LinkUrl = &quot;http:\/\/sp2010\/Documents\/lorem.txt&quot;;\r\nSummaryLinkFieldValue sumlinks = new SummaryLinkFieldValue();\r\nsumlinks.SummaryLinks.Add(link);\r\nsumlinks.SummaryLinks.Add(linkwithinSP);\r\nwp.SummaryLinkValue = sumlinks;\r\n\r\n\/\/add the links to the managedlinks array for automatic link updates by SharePoint\r\nforeach (SummaryLink item in sumlinks.SummaryLinks)\r\n{\r\n wp.ManagedLinks.Add(item.LinkUrl);\r\n}\r\n<\/pre>\n<p>The ManagedLinkHash is generated of the links added to the SummaryLinks webpart.<\/p>\n<p>The result on the page stays the same, but the Content and Structure and SharePoint Manager will display the links correctly:<\/p>\n<p><a href=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2013\/06\/OutgoingLinksSummaryWPContentAndStructureResult_06.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1542\" title=\"OutgoingLinksSummaryWPContentAndStructureResult_06\" src=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2013\/06\/OutgoingLinksSummaryWPContentAndStructureResult_06.png\" alt=\"\" width=\"587\" height=\"252\" srcset=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2013\/06\/OutgoingLinksSummaryWPContentAndStructureResult_06.png 839w, https:\/\/www.itidea.nl\/wp-content\/uploads\/2013\/06\/OutgoingLinksSummaryWPContentAndStructureResult_06-300x128.png 300w\" sizes=\"auto, (max-width: 587px) 100vw, 587px\" \/><\/a><\/p>\n<h5>Figure 7 &#8211; Related resources overview in Content and Structure shows links<\/h5>\n<p><a href=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2013\/06\/OutgoingLinksSummaryWPSPManager_07.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1541\" title=\"OutgoingLinksSummaryWPSPManager_07\" src=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2013\/06\/OutgoingLinksSummaryWPSPManager_07.png\" alt=\"\" width=\"608\" height=\"372\" srcset=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2013\/06\/OutgoingLinksSummaryWPSPManager_07.png 869w, https:\/\/www.itidea.nl\/wp-content\/uploads\/2013\/06\/OutgoingLinksSummaryWPSPManager_07-300x183.png 300w\" sizes=\"auto, (max-width: 608px) 100vw, 608px\" \/><\/a><\/p>\n<h5>Figure 8 &#8211; Properties in SharePoint Manager show links<\/h5>\n<p>When the document will be moved to another library:<br \/>\n<a href=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2013\/06\/OutgoingLinksSummaryWPMoveLinkedDoc_08.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1540\" title=\"OutgoingLinksSummaryWPMoveLinkedDoc_08\" src=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2013\/06\/OutgoingLinksSummaryWPMoveLinkedDoc_08.png\" alt=\"\" width=\"438\" height=\"214\" srcset=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2013\/06\/OutgoingLinksSummaryWPMoveLinkedDoc_08.png 625w, https:\/\/www.itidea.nl\/wp-content\/uploads\/2013\/06\/OutgoingLinksSummaryWPMoveLinkedDoc_08-300x146.png 300w\" sizes=\"auto, (max-width: 438px) 100vw, 438px\" \/><\/a><\/p>\n<h5>Figure 9 &#8211; Moving a document to another location<\/h5>\n<p>The ManagedLinkHash, ManagedLinks and the SummaryLink will be instantly updated.<br \/>\nSummaryLink change can be seen in the Content and Structure overview:<br \/>\n<a href=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2013\/06\/OutgoingLinksSummaryWPMoveLinkedDocContentAndStructureResult_09.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1539\" title=\"OutgoingLinksSummaryWPMoveLinkedDocContentAndStructureResult_09\" src=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2013\/06\/OutgoingLinksSummaryWPMoveLinkedDocContentAndStructureResult_09.png\" alt=\"\" width=\"580\" height=\"253\" srcset=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2013\/06\/OutgoingLinksSummaryWPMoveLinkedDocContentAndStructureResult_09.png 829w, https:\/\/www.itidea.nl\/wp-content\/uploads\/2013\/06\/OutgoingLinksSummaryWPMoveLinkedDocContentAndStructureResult_09-300x130.png 300w\" sizes=\"auto, (max-width: 580px) 100vw, 580px\" \/><\/a><\/p>\n<h5>Figure 10 &#8211; Link changes shown<\/h5>\n<p>The changes to the ManagedLinkHash and ManagedLinks properties can be seen in SharePoint Manager:<br \/>\n<a href=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2013\/06\/OutgoingLinksSummaryWPMoveLinkedDocSPManagerResult_10.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1538\" title=\"OutgoingLinksSummaryWPMoveLinkedDocSPManagerResult_10\" src=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2013\/06\/OutgoingLinksSummaryWPMoveLinkedDocSPManagerResult_10.png\" alt=\"\" width=\"608\" height=\"344\" srcset=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2013\/06\/OutgoingLinksSummaryWPMoveLinkedDocSPManagerResult_10.png 869w, https:\/\/www.itidea.nl\/wp-content\/uploads\/2013\/06\/OutgoingLinksSummaryWPMoveLinkedDocSPManagerResult_10-300x169.png 300w\" sizes=\"auto, (max-width: 608px) 100vw, 608px\" \/><\/a><\/p>\n<h5>Figure 11 &#8211; SharePoint Manager view<\/h5>\n<h3>Summary<\/h3>\n<p>Sharepoint keeps administration about the linked objects in the SummaryLinks webpart. Make sure you do to!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 &#8230; <a class=\"more-link\" href=\"https:\/\/www.itidea.nl\/index.php\/summarylinks-webpart-and-outgoing-links\/\">Read More &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[20,42],"class_list":["post-1537","post","type-post","status-publish","format-standard","hentry","category-sharepoint-2010","tag-c","tag-sharepoint-2010"],"_links":{"self":[{"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/posts\/1537","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/comments?post=1537"}],"version-history":[{"count":11,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/posts\/1537\/revisions"}],"predecessor-version":[{"id":1561,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/posts\/1537\/revisions\/1561"}],"wp:attachment":[{"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/media?parent=1537"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/categories?post=1537"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/tags?post=1537"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}