Programattically set global Navigation Settinigs in O365 sharepoint

Iron Contributor

Hi,

Is there any way to  programattically set the Global navigation settings in Sharepoint Online

Capture.PNG

Can the PnP-Powershell commands set this?

3 Replies

Thanks Juan, that helped. It can be done using the PNP-Powershell commands:

Connect-SPOnline -Url https://tenant.sharepoint.com/teams/IT/Applications -Credentials o365
$context=get-spocontext 
$web=$context.Web 

$context.Load($web)
$siteLogoUrl=$web.SiteLogoUrl

$props=$web.AllProperties
$context.Load($props)

$nav=$web.Navigation
$context.Load($nav)

$context.ExecuteQuery();

$nav.UseShared=$true #Display the same navigation items as the parent site 
$props["__GlobalNavigationIncludeTypes"]=1 #show Subsites
$web.Update()

$context.ExecuteQuery();
Cool! Glad my advide directed you to a solution :)