Hi everyone,
I just got a large SharePoint 2013 site to set up and wanted to set all the sites navigation settings through Windows PowerShell.
It seems to be quite easy, but when I set the “Current Navigation” settings to Structured the UI (user interface) settings page do not show these settings – it Works though, but is a bit confusing. Actually nothing is checked in the boxes, but for now I am good – hope I found out why this is happening. Anyone knows this?

I use the script below to connect to a site Collection, set this navigation settings and afterwards all sub sites. This script do not handle Metadata Navigation.
################################################################
#
# Powershell script by Jesper M. Christensen
# Blog: http://JesperMChristensen.wordpress.com
#
# Set the SharePoint 2010 and 2013 Navigation Settings on Sites
#
# SetupNavigationSettings.ps1 version 1.0 - Edited January 2013
#
################################################################
Write-Host -ForegroundColor White "Set the SharePoint 2010 and 2013 Navigation Settings on Sites"
#Set the Site Collection
$SPSite = Get-SPSite -Identity "http://extrico-demo2.dev.extrico.local/sites/demo1"
#Go through each site in the Site Collection
foreach ($SPWeb in $SPSite.AllWebs)
{
if ($SPWeb.IsRootWeb)
{#Process the root web
Write-Host -ForegroundColor Gray $SPWeb.Url":" -NoNewLine
#Save the AllowUnsafeUpdatesStatus property value
$AllowUnsafeUpdatesStatus = $SPWeb.AllowUnsafeUpdates
$SPWeb.AllowUnsafeUpdates = $true
#Set the Publishing Web
$SPPubWeb = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($SPWeb)
#Global Navigation Settings
$SPPubWeb.Navigation.InheritGlobal = $false
$SPPubWeb.Navigation.GlobalIncludeSubSites = $true
$SPPubWeb.Navigation.GlobalIncludePages = $false
$SPPubWeb.Navigation.GlobalDynamicChildLimit = 21
#Current Navigation Settings
#
# -Display the same navigation items as the parent site: InheritCurrent = $true and ShowSiblings = $false
# -Structural Navigation: Display the current site, the navigation items below the current site, and the current site's siblings: InheritCurrent = $false and ShowSiblings = $true
# -Structural Navigation: Display only the navigation items below the current site: InheritCurrent = $false and ShowSiblings = $false
#
$SPPubWeb.Navigation.InheritCurrent = $false
$SPPubWeb.Navigation.ShowSiblings = $true
$SPPubWeb.Navigation.CurrentIncludeSubSites = $false
$SPPubWeb.Navigation.CurrentIncludePages = $false
$SPPubWeb.Navigation.CurrentDynamicChildLimit = 21
# Sorting
$SPPubWeb.Navigation.OrderingMethod = "Manual" # "Automatic" "ManualWithAutomaticPageSorting"
$SPPubWeb.Navigation.AutomaticSortingMethod = "Title" # "CreatedDate" "CreatedDate" "LastModifiedDate"
$SPPubWeb.Navigation.SortAscending = $true
#Update the Publishing Web Navigation Settings
$SPPubWeb.Update()
Write-Host -ForegroundColor Green " Done"
}
else
{#Process all sub-webs to the root web
Write-Host -ForegroundColor Gray $SPWeb.Url":" -NoNewLine
#Save the AllowUnsafeUpdatesStatus property value
$AllowUnsafeUpdatesStatus = $SPWeb.AllowUnsafeUpdates
$SPWeb.AllowUnsafeUpdates = $true
#Set the Publishing Web
$SPPubWeb = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($SPWeb)
#Global Navigation Settings
$SPPubWeb.Navigation.InheritGlobal = $true
$SPPubWeb.Navigation.GlobalIncludeSubSites = $true
$SPPubWeb.Navigation.GlobalIncludePages = $false
$SPPubWeb.Navigation.GlobalDynamicChildLimit = 21
#Current Navigation Settings
$SPPubWeb.Navigation.InheritCurrent = $false
$SPPubWeb.Navigation.ShowSiblings = $true
$SPPubWeb.Navigation.CurrentIncludeSubSites = $false
$SPPubWeb.Navigation.CurrentIncludePages = $false
$SPPubWeb.Navigation.CurrentDynamicChildLimit = 21
# Sorting
$SPPubWeb.Navigation.OrderingMethod = "Manual" # "Automatic" "ManualWithAutomaticPageSorting"
$SPPubWeb.Navigation.AutomaticSortingMethod = "Title" # "CreatedDate" "CreatedDate" "LastModifiedDate"
$SPPubWeb.Navigation.SortAscending = $true
#Update the Publishing Web Navigation Settings
$SPPubWeb.Update()
Write-Host -ForegroundColor Green " Done"
}
#Revert the AllowUnsafeUpdatesStatus property value
$SPWeb.AllowUnsafeUpdates = $AllowUnsafeUpdatesStatus
#Dispose the SPWeb object
$SPWeb.Dispose()
}
#Dispose the SPSite object
$SPSite.Dispose()
Like this:
Like Loading...
I also have this problem. The UI shows nothing, although it seems to work. Did you find a solution to this? Is it a bug?
No, unfortunately not …
Yup, API change. This code works for me on premise.
SPSite site = new SPSite(“http://devbox”);
SPWeb web = site.OpenWeb(“v9″);
PublishingWeb pWeb = PublishingWeb.GetPublishingWeb(web);
Microsoft.SharePoint.Publishing.Navigation.WebNavigationSettings navSetting = new Microsoft.SharePoint.Publishing.Navigation.WebNavigationSettings(web);
navSetting.CurrentNavigation.Source = Microsoft.SharePoint.Publishing.Navigation.StandardNavigationSource.PortalProvider;
navSetting.Update();
In my scenario I have to make it work from CSOM however (aka in new Office 365).