none
SharepOint 2010 QuickLaunch is always null and cannot add new link through the GUI RRS feed

  • Question

  • Hi Guys,

    I created a blank site from a custom webtemplate. Initially there were no link in my quick launched. But now on the existing site created from my web template I try to add link to my quick launch nothing works. If I try to add a link to my quick launch no bugs but, the quick launch never takes the changes my new links never appear. If I try to change any other settings of my quick launch I have a big error saying Null reference exception in ok_button method of Microsoft.SharePoint.Publishing.Internal.CodeBehind.AreaNavigationSettingsPage.

    Can someone helps please? Its look like its one of the multiple bugs of SharePoint?

    Thanks


    Sherman Body love

    Friday, December 14, 2012 4:05 PM

Answers

  • Hi Guys,

    I created a blank site from a custom webtemplate. Initially there were no link in my quick launched. But now on the existing site created from my web template I try to add link to my quick launch nothing works. If I try to add a link to my quick launch no bugs but, the quick launch never takes the changes my new links never appear. If I try to change any other settings of my quick launch I have a big error saying Null reference exception in ok_button method of Microsoft.SharePoint.Publishing.Internal.CodeBehind.AreaNavigationSettingsPage.

    Can someone helps please? Its look like its one of the multiple bugs of SharePoint?

    Thanks


    Sherman Body love

    YEEEEEEEERRR GUYS I found the solution.

    Explanation:

    The problem is that the tricky QuickLaunch if you create your web site from a webtemplate with an empty quick launch, the QuickLaunch in the database and in object model is null. If you try to use the SPWEB.NAvigation.QuickLaunch from code for example the property will always be Null. Even for SharePoint itself when you modify the quicklaunch from the GUI you will have a  null reference exception in the logs whithout any further explanations. But sure its just cause SPWeb.Navigation.QuickLaunch is null.

    The solution:

    So to avoid this problem either your change your webtemplate to create site with a QuickLaunch containing some links or your create an empty quicklaunch site and to add new links, create a links to something into the site through code like a list (or page or anything else) with this code:

    elevatedWeb.Navigation.AddToQuickLaunch(

    new SPNavigationNode("Fils d*****", "/sites/***********/Lists/Posts/"), SPQuickLaunchHeading.Lists);

    elevatedWeb.Update();

    this code will instanciate the quicklaunch property and add a "fake" link in your quick launch. After this you will be able to do anything you want with the quick launch


    Sherman Body love

    Friday, December 14, 2012 7:42 PM