How to disable quick launch bar using PowerShell in SharePoint Online?

How to hide the quick launch menu in SharePoint online using PnP PowerShell?

No comments

 10,367 total views,  20 views today

Many times due to the business requirement, we want to hide the quick launch or left navigation from our SharePoint modern team site collection. In this tutorial, we will learn about how to hide or disable the quick launch menu from SharePoint online site using the PnP PowerShell and SharePoint site settings page. A little brief about what quick launch navigation menu is in SharePoint – a menu that is displayed in the left side panel of the site is called the quick launch menu. Please have a look at the below screen.

Quick Launch Menu in SharePoint Online
Quick Launch Menu in SharePoint Online

In the modern SharePoint, when we create a team site, the quick launch menu gets displayed automatically at the sidebar whereas when we create a communication site the quick launch menu does not display.

What is the advantage of hiding or disabling the quick launch menu in SharePoint?

The main advantage is, we will get more space to display our content on the home page and we can add much more modern web parts to make our site better and nicer.

Lets, start first, how we can hide or disable the quick launch menu in SharePoint using the Site settings page?

Steps to hide quick launch / left navigation / left menu / side navigation

How to disable quick launch bar using PowerShell in SharePoint Online?
How to hide the quick launch menu in SharePoint online using PnP PowerShell?

Step 1: Go to Site Settings

Click on the site gear icon.

Click on Site information

Site information from SharePoint site settings
Site information from SharePoint site settings

Click on the “View all site settings” link.

View all site settings from site information in SharePoint Online
View all site settings from site information in SharePoint Online

Click on the “Navigation Elements” link from the “Look and Feel” section of the “Site Settings” page.

Navigation elements in site settings page - SharePoint look and feel
Navigation elements in site settings page – SharePoint look and feel

Note:

  • You can even directly, go to the site settings page by the below URL.
https://yoursiteURL/_layouts/15/settings.aspx

 

Un-check the “Enable Quick Launch” checkbox and click on the “Ok” button.

Site Settings - navigation elements - enable quick launch-SharePoint Online
Site Settings – navigation elements – enable quick launch-SharePoint Online

After disabling the “Enable Quick Launch” checkbox, navigate to the site home page, we can see that the quick launch menu is hidden, now we can see the flat view of the site.

Quick Launch is disabled or hidden in SharePoint Online Team Site
Quick Launch is disabled or hidden in SharePoint Online Team Site

In the above steps, we have seen how we can hide the quick launch/left navigation / left menu/side navigation using the site UI, now we will learn how we can hide the quick launch using the PowerShell CSOM coding.

Hide quick launch / left navigation / left menu / side navigation using the PowerShell  CSOM coding:

Using the below PowerShell coding, we can hide the quick launch/left navigation / left menu/side navigation:


############################Description#######################################################
#The below script will disable the quick launch menu in SharePoint online team site.
##############################################################################################

#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"
cls

$fileName = "Disable Quick Launh Menu"
#'yyyyMMddhhmm yyyyMMdd
$enddate = (Get-Date).tostring("yyyyMMddhhmmss")
#$filename = $enddate + '_VMReport.doc'
$logFileName = $fileName +"_"+ $enddate+"_Log.txt"
$invocation = (Get-Variable MyInvocation).Value
$directoryPath = Split-Path $invocation.MyCommand.Path

$directoryPathForLog=$directoryPath+"\"+"LogFiles"
if(!(Test-Path -path $directoryPathForLog))
{
New-Item -ItemType directory -Path $directoryPathForLog
#Write-Host "Please Provide Proper Log Path" -ForegroundColor Red
}
#$logPath = $directoryPath + "\" + $logFileName

$logPath = $directoryPathForLog + "\" + $logFileName

$isLogFileCreated = $False

#DLL location

$directoryPathForDLL=$directoryPath+"\"+"Dependency Files"
if(!(Test-Path -path $directoryPathForDLL))
{
New-Item -ItemType directory -Path $directoryPathForDLL
#Write-Host "Please Provide Proper Log Path" -ForegroundColor Red
}

#DLL location
$clientDLL=$directoryPathForDLL+"\"+"Microsoft.SharePoint.Client.dll"
$clientDLLRuntime=$directoryPathForDLL+"\"+"Microsoft.SharePoint.Client.Runtime.dll"

Add-Type -Path $clientDLL
Add-Type -Path $clientDLLRuntime
#File Download location

$directoryPathForFileDownloadLocation=$directoryPath+"\"+"Downloaded Files"
if(!(Test-Path -path $directoryPathForFileDownloadLocation))
{
New-Item -ItemType directory -Path $directoryPathForFileDownloadLocation
#Write-Host "Please Provide Proper Log Path" -ForegroundColor Red
}

#File Download location

function Write-Log([string]$logMsg)
{
if(!$isLogFileCreated){
Write-Host "Creating Log File..."
if(!(Test-Path -path $directoryPath))
{
Write-Host "Please Provide Proper Log Path" -ForegroundColor Red
}
else
{
$script:isLogFileCreated = $True
Write-Host "Log File ($logFileName) Created..."
[string]$logMessage = [System.String]::Format("[$(Get-Date)] - {0}", $logMsg)
Add-Content -Path $logPath -Value $logMessage
}
}
else
{
[string]$logMessage = [System.String]::Format("[$(Get-Date)] - {0}", $logMsg)
Add-Content -Path $logPath -Value $logMessage
}
}
#Parameters value
$siteURL="https://globalsharepoint2020.sharepoint.com/sites/CustomSearchRND/"
$userName = "Global-sharepoint2020@globalsharepoint2020.onmicrosoft.com"
$password = "YourSPOPassword"
$securePassword= $password | ConvertTo-SecureString -AsPlainText -Force

Try
{

#Setup the Context
$ctx = New-Object Microsoft.SharePoint.Client.ClientContext($siteURL)
$ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($userName, $securePassword)

#Disable the Quick Launch Menu
$ctx.Web.QuickLaunchEnabled = $False
$ctx.Web.Update()
$ctx.ExecuteQuery()
Write-host -f Green "The quick launch menu has been disabled successfully!"
}
Catch
{
write-host -f Red "Error:" $_.Exception.Message
}

[wp_ad_camp_3]

Hide quick launch / left navigation / left menu / side navigation using the PnP PowerShell coding:

Using the below PnP PowerShell coding, we can hide the quick launch/left navigation / left menu/side navigation:


############################Description#######################################################
#The below script will disable the quick launch menu in SharePoint online team site.
##############################################################################################

CLS
$siteURL="https://globalsharepoint2020.sharepoint.com/sites/CustomSearchRND/"
$userName = "Global-sharepoint2020@globalsharepoint2020.onmicrosoft.com"
$passWord = "YourSPOPassword"
$encPassWord = convertto-securestring -String $passWord -AsPlainText -Force
$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $userName, $encPassWord

Connect-PnPOnline -Url $siteURL -Credentials $cred

#Getting the site's Web object.
$web = Get-PnPWeb

#Disable the Quick Launch Menu
$web.QuickLaunchEnabled = $False
$web.Update()
Invoke-PnPQuery

Quick launch menu hide technique will not work if the SharePoint Server Publishing Infrastructure feature is enabled in your site.

Summary:

Thus, in this article, we have learned the below concepts with respect to quick launch navigation in SharePoint online:

  • Steps by step guide to hide quick launch/left navigation / left menu/side navigation.
  • How to hide or disable SharePoint quick launch menu using the PnP PowerShell script?
  • How to change menu items within SharePoint Online with the PnP command?
  • How to disable a quick launch bar using PowerShell in SharePoint Online?
  • How to hide or disable SharePoint quick launch menu using PowerShell?

 

See Also:

Free download SharePoint Online & Office 365 Administration eBook(238 Pages)

Get the PDF eBook from here:


[purchase_link id="0" style="button" color="blue" text="Free Download SharePoint Online & Office 365 Administration"]

 

 
FREE DOWNLOAD

Send download link to:

Subscribe to get exclusive content and recommendations every month. You can unsubscribe anytime.