24 Sep 2010

Updating Navigation in SharePoint fails for publishing websites

Posted by Alexander

Since the last two tweeks I have been experiencing problems updating the navigation of a new SharePoint 2010 publishing website. As you all know it is possible to change the navigation on site level in SharePoint. Adding, deleting and hiding of headings and links is easily done through the navigation page (/_layouts/AreaNavigationSettings.aspx). It is even possible to manually override and insert the navigation complete from scratch.

But for some unknown reason any change made on this page and clicking the OK button were discarded. No error was displayed and returning to the navigation page showed us no changes.

After some research (checking your own custom stuff at first of course) I had to go to one of our customers for some troubleshooting around SharePoint issues regarding a MOSS 2007 intranet environment (using the publishing capabilities). And to my surprise they reported the same problem on some of their sites.

So we started to investigate, read a lot of articles, forums and blogs. Not any answer was to be found except some remark we found about the <NavBars> element inside the ONET.XML definition file for a site definition.

For my project I didn’t specify that element due to the standard (clean) template I used inside VS2010. Looking at the site definitions used by this customer (made by another external party) it seems that exactly those site definitions used by the failing sites seems to have also not the <NavBars> element defined. We changed on of the templates and created a new site. And yes… it worked!

It seems that when that <NavBar> element is not specificied, an entry is missing causing the SPWeb.Navigation.TopNavigationBar to be null. Resulting in the fact that when the navigation page tries to store your changes it will fail.

To fix the problem you will need to specify a <NavBar> element for the Global Navigation based on the hard-coded id=”1002”.  The following is necessary for publishing sites in your site defintion to have the global navigation work properly.

<NavBars>
    <NavBar Name=”SharePoint Top Navbar” ID=”1002″ />
</NavBars>

The problem with this fix is that you will need to recreate the site. Resetting to the site definition will not take over changes made in the ONET.XML. This will cause to lose all your content and is often not an option.

I have been looking for a solution to create a new SPWeb.Navigation.TopNavigationBar programmatically. But no solution was found by me or by somebody else. And even finding a solution will cause to create a new id in stead of the id=”1002”. The problem with that is that the global navigation looks hard-coded for the id=”1002.

There is another (not supported by Microsoft) solution to fix this problem/bug for existing publishing sites. It incorporates changes made to the content database of SharePoint. This is not supported by Microsoft and could eventually result into loss of support on future SharePoint issues which will need assistance of Microsoft. If you want to go this direction then read the following post: http://statto1974.wordpress.com/2008/04/09/beware-of-deleting-global-navigation-nodes-in-spwebnavigationglobalnodes/

The last method which could solve your problem depends on your current environment. If you have the ability to setup a new clean environment of the company works with an OTAP model this could solve your problem. You will need to do the following:

1) Setup a clean web application (on another machine)
2) Install the fixed site definitions on that machine
3) Start a content deployment from the current machine to that machine. It will regenerate the sites using the new fixed site definitions and fill it with content from the current.
4) Clean the current machine
5) Reinstall the fixed site definitions on the current machine
6) Start a content deployment back.

This problem (or actually SharePoint bug) is found in MOSS 2007  and SharePoint 2010 publishing solutions. Hopefully will Microsoft solve this and create a patch (if they haven’t done already).

If anyone has suggestions or other solutions do not hesitate to contact me. I will then update this post accordingly.

Subscribe to Comments

4 Responses to “Updating Navigation in SharePoint fails for publishing websites”

  1. Can you email for me about problem you met for Navbar and show me which way to fix that

     

    ltd0501

  2. Can you email for me about problem that you met for Navbar

    and

    Can you show me which ways to fix them?

    Thank,
    ltd0501

     

    ltd0501

  3. For me this was the fix:

    http://support.microsoft.com/default.aspx?scid=kb;en-US;2484317

    is this the same [problem?

    Greets,
    Ron

     

    Ron Lagerwaard

  4. Actually no… you are mentioning an issue regarding language packs and publishing pages while this has something to do with defining an site definition

     

    Alexander

Leave a Reply

Message: