Manage SharePoint communication site megamenu with CSOM and PowerShell

You may have already noticed that site navigation style have changed on newly created SharePoint Online communication sites. Experience is currently different on sites created earlier.

Megamenu navigation enabled
Old style navigation

Here is a quick-n-dirty PowerShell script to change experience back to old style navigation on newly created communication sites.

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client") | Out-Null
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.Runtime") | Out-Null

$webUrl = "<site url>"
$username = "<username>@<tenant>"
$pw = read-host -Prompt "Enter password" -AsSecureString

$ctx= New-Object Microsoft.SharePoint.Client.ClientContext($webURL)
$ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username,$pw)
$ctx.Web.MegaMenuEnabled = $false //Disables megamenu experience

Edited 22.8.2018 17.33:

Of course you can do it with PnP PowerShell.

Connect-PnPOnline -Url <yoursite>
$web = Get-PnPWeb
$web.MegaMenuEnabled = $false //$false to disable, $true to enable

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Powered by

Up ↑

%d bloggers like this: