Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Programmatically enable Show Subsites and Show Pages for Current navigation in SharePoint
WhatsApp
Vijai Anand Ramalingam
13y
10.6
k
0
0
25
Blog
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
using
(
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 =
false
;
//Show Pages
publishingWeb.Navigation.CurrentIncludePages =
false
;
// Maximum number of dynamic items to show within this level of navigation:
publishingWeb.Navigation.CurrentDynamicChildLimit = 50;
//Update the changes
publishingWeb.Update();
}
}
Programmatically enable Show Subsites and Show Pages for Current navigation in SharePoint
Up Next
Programmatically Check whether Current Logged in User is a Member of SharePoint User Group or Not
Ebook Download
View all
Getting Started with SharePoint Framework Development using TypeScript, PnP JS, and React JS
Read by 4.9k people
Download Now!
Learn
View all
Membership not found