SIGN UP MEMBER LOGIN:    
ARTICLE

Quick Launch Navigation for SharePoint Publishing Sites

Posted by Vijai Anand Articles | SharePoint 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
share 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
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor
PREMIUM SPONSORS
  • Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites - Click Here!
    Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites - Click Here!
Team Foundation Server Hosting
Become a Sponsor