ARTICLE

Quick Launch Navigation for SharePoint Publishing Sites

Posted by Vijai Anand Articles | SharePoint 2010 April 25, 2011
In this article we will be seeing how to add a heading or link and how to delete the heading or link from the SharePoint publishing site quick launch.
Reader Level:

In this article we will be seeing how to add a heading or link and how to delete the heading or link from the SharePoint publishing site quick launch.

I have a site collection with the SharePoint Server Publishing Infrastructure feature enabled on the site collection and sites with the SharePoint Server Publishing site feature activated.

Go to Site Actions => Site Settings => Look and Feel => Navigation => Navigation Editing and Sorting.

Share1.gif

In the Navigation Editing and Sorting you could see the following options.

Share2.gif

Programmatically Add or Delete Heading and Link:

using (SPSite siteCollection = new SPSite("http://servername:1111/sites/sample"))
            {
                using (SPWeb web = siteCollection.RootWeb)
                {
                    PublishingWeb publishingWeb = PublishingWeb.GetPublishingWeb(web);
                    SPNavigationNodeCollection nodeColl=publishingWeb.Navigation.CurrentNavigationNodes;

                    // Create or Delete heading and link
                }
            }

####################################################################################

// Create a new heading

SPNavigationNode newHeading = SPNavigationSiteMapNode.CreateSPNavigationNode("Heading", "", NodeTypes.Heading, nodeColl);

// Create a new link

SPNavigationNode newLink = SPNavigationSiteMapNode.CreateSPNavigationNode("Link", "", NodeTypes.AuthoredLinkToWeb, newHeading.Children);

//Delete a heading or link

 int count=nodeColl.Count;
 while (count != 0)
 {
   if (nodeColl[count - 1].Title == "MyHeading")
   {
     nodeColl[count - 1].Delete();
   }
   count--;
 }

Login to add your contents and source code to this article
post comment
     

Thank you so much :-)

Posted by Vijai Anand Apr 25, 2011

Useful article Vijai...your articles are very helpful for sharepoint developers...

Posted by Dinesh Beniwal Apr 25, 2011
COMMENT USING
PREMIUM SPONSORS
DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and add new content to existing PDF documents from within your applications.
Get Career Advice from Experts
SPONSORED BY
  • PDF reports have never been easier to create. With our included WYSIWYG Designer, you can layout your reports, set up your data source and let DynamicPDF ReportWriter do the rest.
Join a Chapter