Setting style of Quick Launch Navigation with PowerShell
-
14-02-2021 - |
La solution
Try using below code:
[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>.onmicrosoft.com"
$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.Load($ctx.Web)
$ctx.ExecuteQuery()
$ctx.Web.MegaMenuEnabled = $false //Disables megamenu experience
$ctx.Web.Update()
$ctx.ExecuteQuery()
OR: Using PnP PowerShel:
Connect-PnPOnline -Url <yoursite>
$web = Get-PnPWeb
$web.MegaMenuEnabled = $false //$false to disable, $true to enable
$web.Update()
Invoke-PnPQuery
Source: Manage SharePoint communication site megamenu with CSOM and PowerShell
You can also use Set-PnPWeb command to set MegaMenuEnabled
parameter of SharePoint web.
Licencié sous: CC-BY-SA avec attribution
Non affilié à sharepoint.stackexchange