.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Home >> Articles >> SharePoint >> Post New Resource Bookmark and Share   

 Subscribe to Articles

Programmatically enable Show Subsites and Show Pages for Global navigation in SharePoint

Posted By:Vijai Anand. R       Posted Date: May 14, 2011    Points: 200    Category: SharePoint    URL: http://www.dotnetspark.com  

In this article we will be seeing how to enable or disable Show Subsites and Show Pages for Global navigation using object model in SharePoint 2010

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 => Global Navigation.


In the global navigation you could see the following options


Programmatically Enable/Disable Global Navigation Settings

using (SPSite siteCollection = new SPSite("http://servername:1111/sites/sample"))
using (SPWeb web = siteCollection.RootWeb)
PublishingWeb publishingWeb = PublishingWeb.GetPublishingWeb(web);
// Global Navigation
//Show Subsites
publishingWeb.Navigation.GlobalIncludeSubSites =
//Show Pages
publishingWeb.Navigation.GlobalIncludePages =
// Maximum number of dynamic items to show within this level of navigation:
publishingWeb.Navigation.GlobalDynamicChildLimit = 60;

//Update the changes


 Subscribe to Articles


Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend