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 1


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
 $subWebs=Get-PnpSubWebs -Recurse
 foreach ($sub in $subWebs)
    $sub.QuickLaunchEnabled = $true
    $sub.TreeViewEnabled = $true

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 online
    – Liz
    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 SharePointPnPPowerShellOnline
    – Jerry_MSFT
    Jun 8, 2020 at 1:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.