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

Top 5 Contributors of the Month

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

 Subscribe to Articles

Programmatically enable Show Subsites and Show Pages for Current 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 Show subsites and Show Pages for Current 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 => Current Navigation.


In the current navigation section  you could see the following options


Programmatically Enable/Disable Current Navigation Settings

(SPSite siteCollection = new SPSite("http://servername:1111/sites/sample"))
using (SPWeb web = siteCollection.RootWeb)
PublishingWeb publishingWeb = PublishingWeb.GetPublishingWeb(web);
// Current navigation
//Show Subsites
publishingWeb.Navigation.CurrentIncludeSubSites =
//Show Pages
publishingWeb.Navigation.CurrentIncludePages =
// Maximum number of dynamic items to show within this level of navigation:
publishingWeb.Navigation.CurrentDynamicChildLimit = 50;

//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