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 sorting for Navigation SharePoint
WhatsApp
Vijai Anand Ramalingam
13y
7.1
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 => Sorting
.
Programmatically Enable/Disable Sorting for navigation
using
(
SPSite
siteCollection =
new
SPSite
(
"http://servername:1111/sites/sample"
))
{
using
(
SPWeb
web = siteCollection.RootWeb)
{
PublishingWeb
publishingWeb =
PublishingWeb
.GetPublishingWeb(web);
// Sorting
// Do sorting
publishingWeb.Update();
}
}
########################################################################################################
// Sort manually
publishingWeb.Navigation.OrderingMethod =
OrderingMethod
.Manual;
//Sort manually with automatic paging
publishingWeb.Navigation.OrderingMethod =
OrderingMethod
.ManualWithAutomaticPageSorting;
//sort automatically
publishingWeb.Navigation.OrderingMethod =
OrderingMethod
.Automatic;
//Sort by title
publishingWeb.Navigation.AutomaticSortingMethod =
AutomaticSortingMethod
.Title;
//Sort by created date
publishingWeb.Navigation.AutomaticSortingMethod =
AutomaticSortingMethod
.CreatedDate;
//Sort by last modified date
publishingWeb.Navigation.AutomaticSortingMethod =
AutomaticSortingMethod
.LastModifiedDate;
//Sort by ascending order
publishingWeb.Navigation.SortAscending =
true
;
//Sort by descending order
publishingWeb.Navigation.SortAscending =
false
;
Programmatically enable sorting for Navigation SharePoint
Up Next
Programmatically enable Show Subsites and Show Pages for Global navigation in SharePoint
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