Skip Ribbon Commands
Skip to main content

SharePoint Cross Site Collection Common Top Navigation

 

James Strugnell

14/03/2012

A recent requirement was called for a SharePoint solution that would allow for cross site collection navigation in large farms.

The main issue was the administration of the navigation as there were 20+ site collections meaning that they all had to be changed one by one. This raised a few issues, time, effort required and consistency.

The farm used a common master page though-out, but they wanted a number of site collections to use the out of the box navigation and then others to use the common navigation.
The solution we came up with was to utilise the ASP.Net site map provider with the SharePoint navigation control within the master page. This solved the problem of having multiple places to edit, but raised a few new ones. As the navigation would not change often this was not a big problem, but it was the ability to change the navigation. Every time you would want to change the navigation then a solution upgrade would have to be performed.

The following is how to implement this as a Visual studio solution:

1. Create a copy of your existing masterpage and add it to the project.

2. Create Assets folder then a folder called Masterpages add the masterpage here.

3. On the Master Page find the following control.

<asp:ContentPlaceHolder id="PlaceHolderTopNavBar" runat="server">

         <asp:ContentPlaceHolder id="PlaceHolderHorizontalNav" runat="server">

                 <SharePoint:AspMenu

                          ID="TopNavigationMenuV4"

                          Runat="server"

                          EnableViewState="false"

                          DataSourceID="topSiteMap"

                          AccessKey="<%$Resources:wss,navigation_accesskey%>"

                          UseSimpleRendering="true"

                          UseSeparateCss="false"

                          Orientation="Horizontal"

                          StaticDisplayLevels="2"

                          MaximumDynamicDisplayLevels="2"

                          SkipLinkText=""

                          CssClass="s4-tn"/>

                  <SharePoint:DelegateControl runat="server" ControlId="TopNavigationDataSource" Id="topNavigationDelegate">

                          <Template_Controls>

                                   <asp:SiteMapDataSource

                                            ShowStartingNode="False"

                                            SiteMapProvider="SPNavigationProvider"

                                            id="topSiteMap"

                                            runat="server"

                                            StartingNodeUrl="sid:1002"/>

                          </Template_Controls>

                 </SharePoint:DelegateControl>

         </asp:ContentPlaceHolder>

</asp:ContentPlaceHolder> 

4. Replace the above code with this:

            <asp:ContentPlaceHolder id="PlaceHolderTopNavBar" runat="server">
            
                        
            <asp:ContentPlaceHolder id="PlaceHolderHorizontalNav" runat="server">
            
                                
            <SharePoint:AspMenu
            
                                         
            ID="TopNavigationMenuV4"
            
                                         
            Runat="server"
            
                                         
            EnableViewState="false"
            
                                         
            DataSourceID="topSiteMap"
            
                                         
            AccessKey="<%$Resources:wss,navigation_accesskey%>"
            
                                         
            UseSimpleRendering="true"
            
                                         
            UseSeparateCss="false"
            
                                         
            Orientation="Horizontal"
            
                                         
            StaticDisplayLevels="2"
            
                                         
            MaximumDynamicDisplayLevels="4"
            
                                         
            SkipLinkText=""
            
                                         
            CssClass="s4-tn"/>
            
                                
            <SharePoint:DelegateControl runat="server" ControlId="TopNavigationDataSource1">
            
                                         
            <Template_Controls>
            
                                                  
            <asp:SiteMapDataSource
            
                                                           
            ShowStartingNode="True"
            
                                                           
            SiteMapProvider="CustomTopNavProvider"
            
                                                           
            id="topSiteMap"
            
                                                           
            runat="server" 
            />
            
                                         
            </Template_Controls>
            
                                
            </SharePoint:DelegateControl>
            
                        
            </asp:ContentPlaceHolder>
            </asp:ContentPlaceHolder> 

5. Note that the provider has changed to the customTopNavProvider, configuring the ASPMenu control also allows you to have more control over the Navigation.

6. Save the file and add the following to the Elements.xml of the feature so that the master page is referenced:

            
               <Module Name="Masterpage and Page Layouts" List="116" Url="_catalogs/masterpage" >
    <File Type="GhostableInLibrary" 
Path="Assets\Masterpages\citricCommonNav.master" 
Url="citricCommonNav.master" />
</Module>

7. Add feature event receiver, on feature activated there is an addition to the Web Config that will reference the site map provider, when deactivated this is then removed.

            public override void FeatureActivated(SPFeatureReceiverProperties properties)
            {   
                SPWebApplication webApp = (SPWebApplication)properties.Feature.Parent;
                webConfigMod(true, webApp);
            }
            public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
            {
                SPWebApplication webApp = (SPWebApplication)properties.Feature.Parent;
                webConfigMod(false, webApp);
            }
            private void webConfigMod(bool addOrRemove, SPWebApplication webApp)
            {
                SPWebConfigModification modifyWebConfig = new SPWebConfigModification();
                modifyWebConfig.Path = "configuration/system.web/siteMap/providers";
                modifyWebConfig.Name = "add[@name=\"CustomTopNavProvider\"]";
                modifyWebConfig.Sequence = 0;
                modifyWebConfig.Owner = "add[@name=\"CustomTopNavProvider\"]";
                modifyWebConfig.Type = SPWebConfigModification.SPWebConfigModificationType.EnsureChildNode;
                modifyWebConfig.Value = "<add name=\"CustomTopNavProvider\" 
             siteMapFile=\"/_layouts/1033/Citric/SiteMapProvider/CustomTopNavMenu.sitemap\" 
             type=\"System.Web.XmlSiteMapProvider,System.Web, 
             Version=2.0.0.0, Culture=neutral, 
             PublicKeyToken=b03f5f7f11d50a3a\"/>";

     if (addOrRemove)

                {
                    webApp.WebConfigModifications.Add(modifyWebConfig);
                }
                else
                {
                    for (int c = webApp.WebConfigModifications.Count - 1; c >= 0; c--)
                    {
                        if (webApp.WebConfigModifications[c].Owner == "add[@name=\"CustomTopNavProvider\"]")
                        {
                            webApp.WebConfigModifications.Remove(webApp.WebConfigModifications[c]);
                        }
                    }
                }
                webApp.Update();
                webApp.Farm.Services.GetValue<SPWebService>().ApplyWebConfigModifications();
            }

8. Add a SharePoint mapped Layouts folder and create the structure as followed.

TEMPLATE  -> LAYOUTS -> 1033 -> CITRIC -> SiteMapProvider

9. Add a new sitemap document to the SiteMapProvider folder.

10. The base document should look something like this:

            
               <?xml version="1.0" encoding="utf-8" ?>
            
               <siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
            
                 <siteMapNode url="/" title="Citric" description="">
            
                   <siteMapNode url="/Home" title="Home" description="" />
            
                   <siteMapNode url="/Services" title="Services" description="" >
            
                     <siteMapNode url="/Consultancy" title="Consultancy" description="" />
            
                     <siteMapNode url="/Development" title="Development" description="" />
            
                     <siteMapNode url="/Hosting" title="Hosting" description="" />
            
                     <siteMapNode url="/Support" title="Support" description="" >
            
                       <siteMapNode url="/SubSupport" title="SubSupport" description="" />
            
                     </siteMapNode>
            
                   </siteMapNode>
            
                   <siteMapNode url="/Solutions" title="Solutions" description="" />
            
                   <siteMapNode url="/Case Studies" title="Case Studies" description="" />
            
                   <siteMapNode url="/Citric Blog" title="Citric Blog" description="" />
            
                   <siteMapNode url="/Clients" title="Clients" description="" />
            
                   <siteMapNode url="/About" title="My Business" description="">
            
                   </siteMapNode>
            
                   <siteMapNode url="/search" title="Search" description="" />
            
                 </siteMapNode>
            
               </siteMap>

11. Once all packaged up as a solution, all that is required is to select the common masterpage (edited and deployed above) and your common navigation feature activated.


 About us

Fuse Collaboration Services is a Cloud Solution Provider and Microsoft Gold Partner specialising in delivering SharePoint, Skype for Business, and Azure cloud-based solutions. Based in Northampton, UK.

Microsoft Gold Partner Logo showing 5 competencies

Read more

 Latest Tweets

 Latest Blog

 

 

Clear out the ROT!140<p class="lead">​​They might give examples of damp rot or rotten food but ROT in the IT world is an acronym and if you apply the definition of rot to your data it's not far off what this blog is essentially about.</p><p class="lead">The acronym ROT when referring to IT stands for <strong>Redundant, Obsolete and Trivial</strong> and it's used when describing your digital data that your business keeps hold of when it has no value. Employees create ROT every day without realising how much this impacts your business.</p><p>ROT can be found on network and SharePoint servers, desktops, mobile devices such as laptops and mobile phones, on premise and in the cloud. Its impact can be huge and will become even more of a worry when the new GDPR* comes into force on May 25<sup>th</sup> 2018. </p><p>​ <strong>Reasons to clear the ROT out&#58;</strong></p><ol>​ <li> <strong>It decreases the need for extra storage.</strong><br>Funding extra storage, costs businesses money; not only having to pay for the extra storage but extra storage creates the need for a bigger IT infrastructure (and more IT support staff) and hardware which all rise costs.<br></li><li> <strong>Prevents data becoming a liability risk.</strong>​ <br>For businesses that are subject to audits, clearing out the ROT is an important part of the process. Businesses need to be able to demonstrate they are compliant within a whole range of regulations and legal guidelines dependent on the sector the business operates in.<br></li><li> <strong>Improves productivity in staff</strong>. <br>The need to quickly access the right information instead of wading through irrelevant documents will increase the delivery of projects and increase productivity on a day to day basis. This in turn increases productivity and profit margins.<br></li><li> <strong>Prevents data breaches.</strong><br>Clearing out the ROT can be viewed as time consuming and not a profitable use of time. The less information your company has that has no business or legal value reduces the chance of a data breach. If there is a data breach then you open yourselves up to costly legal action that is easily preventable.<br></li><li> <strong>GDPR is coming.</strong><br>May 25<sup>th</sup> 2018 is a date that you need to have etched in your brain if you are the owner of a business. The new regulations are replacing the outdated Data Protection Act and is a well needed reaction to the change in how data is stored, transferred and managed. Individual's now have far more rights and businesses will have to ensure that they have the legal consent to process data. All personal data that you hold, where it came from and who you share it with now needs to be documented. Getting rid of obsolete data will help to prevent any breaches of GDPR.<br></li> ​ </ol> <p class="small">*GDPR(The General Data Protection Regulation) is the European Union's new legislation to protect the personal data of all EU citizens and has evolved from the need to regulate data protection by updating the 1995 Data Protection Directive (DPD). This set of regulations is now out of date due to the increasing advances in the digital and technology world.<br>Organisations have been given a two-year lead in period to become compli​ant, ending 25th May 2018.​</p><p> <strong>How can Fuse help you clear out the ROT?</strong></p><p>Fuse is a specialist in SharePoint and has an in-house team of consultants. If you currently store terabytes of data held within an on-premise infrastructure and you are worried about GDPR because your data is unstructured and therefore unmanageable, Fuse can help. Fuse implements solutions that help to analyse the data held by your organisation; structure your data; identify unwanted and duplicated data. This is all done quickly and securely. </p><p>Once your data is in a manageable format we can provide the tools that will identify and collect GDPR personal information within documents. Workflows can be created to generate documents and automate your requests for &quot;the right to be forgotten&quot;. &#160;Not only are we good at it, it will give you peace of mind as you will be preventing any GDPR breaches. Become compliant by binning the ROT! </p><div class="well well-lg"><p class="lead">​If you have any questions or would like to speak to someone about your current system, call 01604 797979 for​ a no obligation chat!</p></div>l.ozier@fusecollaboration.com | Louise Ozier | 693A30232E777C6675736563735C6C2E6F7A696572 i:0#.w|fusecs\l.ozier24/07/2017 23:00:002017-07-24T23:00:00ZIf you were to ask most people what the definition of rot is, you are more than likely to get answers along the lines of "something that's damaged, something that you can't use anymore or something that is decaying or gone bad". 26/07/2017 10:55:54htmlFalseaspx

 Contact us

Our address
12-14 Brookfield, Duncan Close
Moulton Park, Northampton
NN3 6WL
P: +44(0)1604 797979
Contact Us