SharePoint Online: How to Hide the Left Navigation Bar using PowerShell?

Requirement: Hide Quick Launch Bar in SharePoint Online.

How to Hide the Quick Launch in SharePoint Online?

The Quick Launch or left navigation located on the left side of the site typically contains links to resources located in the current site, like lists and libraries, subsites, etc. As a SharePoint Online user, you may have noticed that the left navigation bar is always displayed, regardless of which page you’re on. This can be helpful when you’re working with lists and libraries, however, In some cases, you may want to hide the left navigation bar to simplify the user interface and allow your content to stand out. In this article, we will show you how to disable the left navigation bar in SharePoint Online.

To turn off the quick launch in SharePoint Online, Go to:

  1. Site Settings >> Click on “Navigation Elements” under Look and Feel
  2. Uncheck “Enable Quick Launch” and Click OK.
    sharepoint online disable quick launch bar

This removes quick launch in SharePoint Online.

Disable left navigation (or top navigation bar) in Modern SharePoint Online Sites

The modern navigation options also let you turn off navigation from SharePoint Online sites.

  1. Login to your SharePoint Online site >> Click on the Settings gear
  2. Click on “Change the Look” in the settings menu >> and then click on “Navigation” under the “Change the look” pane.
  3. Now, you can enable or disable the navigation by setting the “Site Navigation visibility” switch.
  4. Click on the “Save” button to commit your changes
sharepoint online turn off left navigation

SharePoint Online: How to hide left navigation using SharePoint Designer?

You can also hide the quick launch in SharePoint Online from SharePoint Designer. Open the SharePoint designer site and uncheck “Display Quick Launch” under settings and save!

hide quick launch in sharepoint online using sharepoint designer

SharePoint Online: Disable Quick Launch using PowerShell

Here is how to hide left navigation in SharePoint Online:

#Load SharePoint CSOM Assemblies
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"

#Config Variable
$SiteURL="https://Crescent.sharepoint.com/sites/Marketing" 

#Setup Credentials to connect
$Cred = Get-Credential
 
Try {
    #Setup the context
    $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
    $Ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.UserName,$Cred.Password)
 
    #Disable Quick Launch
    $Ctx.Web.QuickLaunchEnabled = $False
    $Ctx.Web.Update()
    $Ctx.ExecuteQuery()
    Write-host -f Green "Quick Launch Bar Disabled Successfully!"
}
Catch {
    write-host -f Red "Error:" $_.Exception.Message
}

Hide quick launch using PnP PowerShell:

To hide the left navigation bar in SharePoint Online, use this PnP PowerShell:

#Config Variables
$SiteURL = "https://Crescent.sharepoint.com/sites/marketing"

#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -Interactive

#Get the Web
$Web = Get-PnPWeb

#hide left navigation bar in sharepoint online
$web.QuickLaunchEnabled = $False
$web.Update()
Invoke-PnPQuery

This script works if the quick launch menu’s orientation is set to Horizontal as well (Top navigation menu). You can also use the Set-PnPWeb cmdlet to disable the navigation on the SharePoint Online site:

Set-PnPWeb -QuickLaunchEnabled:$false

Hide left navigation in SharePoint Online with CSS

You can either deploy an SPFx extension that implements CSS (or use the “Modern Script editor web part” and add it to the page). The CSS to hide the left navigation on a modern page, use this CSS:

<style>

#spLeftNav {
    display: none !important;
}

</style> 

More on the approach to remove the left navigation with CSS: Hide SharePoint Online Quick Launch using CSS

In summary, hiding the left navigation bar in SharePoint Online can be a useful way to simplify the user interface and make your content stand out. By using PowerShell, you can automate this process across multiple sites, making it easier to manage your SharePoint environment. By following the steps outlined in this article, you can quickly and easily hide the left navigation bar in SharePoint Online.

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. Passionate about sharing the deep technical knowledge and experience to help others, through the real-world articles!

Leave a Reply

Your email address will not be published. Required fields are marked *