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

 

 

Skype for Business and so much more…195<p class="lead"> Yes? Then this is an important read!</p><p>We all know (hopefully!) <a href="/_layouts/15/FIXUPREDIRECT.ASPX?WebId=4fc45909-2b6d-48b9-bcf9-a446e9d472d6&amp;TermSetId=c98895cd-d37f-4406-9cff-5480b4f829b6&amp;TermId=4cd8262c-9c67-4bcb-8f13-65e8ffa6299a">what Skype for Business is</a> but what is different about the version we can offer? </p><p>Fuse has been working ​with the UK's leading Skype for Business provider since they began operating four years ago. Working alongside our partners you will receive the usual unified communications inherent in Skype for Business but further to this you will have access to call centre solutions, call monitoring, call analytics and 24-hour support. The support is available globally and frees up IT staff allowing them to increase their productivity and availability. </p><p>Further to the above features you will have access to an online portal which will allow you to quickly commission and decommission users, configure/reconfigure call groups, manage users and telephone numbers, configure interactive voice response(IVR), call routing, on hold marketing and call reporting.</p><p>Working with the solution we offer, you will be given the benefit of not having a long-term contract tying you in to a lengthy subscription. You can down scale or upscale monthly, giving you the control of your budgets. The flexible scale up/down in line with organisational changes is an important bonus to many customers. </p><p>The monthly price works out at half the price of competitors with call bundles and next to no downtime. </p><p> <strong>The benefits are&#58;</strong></p><ul><li>Reduced annual costs as one monthly cost includes unlimited free outbound calls to UK and line telephone numbers. International call packages are available. Free calls to UK mobile numbers available as an add on</li><li>Flexible working - inbound and outbound business calls and online meetings from anywhere with an internet connection</li><li>Encrypted and secure communication<br></li><li>End to End Fully Managed Service</li><li>24 hr, 7 days a week dedicated support; online support and contact centre</li><li>Online Visual Management and Analytics Portal</li><li>Global solution, from reslient datacenters with multiple providers</li><li>Audio and video conference facility for up to 250 participants – even if they're not on Skype for Business. All they need is a phone or internet connection.</li><li>Fixed monthly fee per user that is payable on a monthly subscription</li><li>Integration with Outlook/SharePoint to show availability/presence (on premise or O365)</li><li>Increases productivity - Collaboration between teams is simplified due to the ability to share files etc.</li><li>Instant messaging with dancing emojis!</li></ul><hr />​​ <div class="well well-lg"><p class="lead">​To book a demo contact Fuse Collaboration on 01604 797979 or email fuse@fusecollaboration.com </p></div>​​ <p>Fuse Collaboration is a Microsoft accredited Gold Partner, License and Systems Specialist</p>​ ​l.ozier@fusecollaboration.com | Louise Ozier | 693A30232E777C6675736563735C6C2E6F7A696572 i:0#.w|fusecs\l.ozier26/06/2017 23:00:002017-06-26T23:00:00ZDoes your business make lots of phone calls?29/06/2017 15:18:4654https://www.fusecollaboration.com/ourblog/Pages/Forms/AllItems.aspxhtmlFalseaspx

 Contact us

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