I want to enable tree view navigation in a site collection and sub site level using power shell. Power shell script loop through site collection and all sub sites and turn on Enable Tree View Navigation.
1 Answer
Please use the script below to do enable Tree View
connect-pnponline http://siteurl -Credentials (Get-Credential)
$web = Get-PnPWeb
$web.QuickLaunchEnabled = $true
$web.TreeViewEnabled = $true
$web.Update()
$subWebs=Get-PnpSubWebs -Recurse
foreach ($sub in $subWebs)
{
$sub.QuickLaunchEnabled = $true
$sub.TreeViewEnabled = $true
$sub.Update()
}
Invoke-PnPQuery
It is using Pnp so you may need to install it first.
Reference:Enable/disable Quick Launch and Tree View with PowerShell for SharePoint Online
-
i am running power shell using the CSOM.. can i get the code in power shell onlineLiz– Liz2020-06-05 09:32:48 +00:00Commented Jun 5, 2020 at 9:32
-
@Liz SharePoint Patterns and Practices (PnP) commands use CSOM and can work against both SharePoint Online as SharePoint On-Premises. I assume you want to use it in SharePoint Online Management Shell? Then install the Pnp first. Install-Module SharePointPnPPowerShellOnlineJerry_MSFT– Jerry_MSFT2020-06-08 01:40:25 +00:00Commented Jun 8, 2020 at 1:40