SharePoint Online: How to Disable Quick Launch Bar using PowerShell?

Requirement: Hide Quick Launch Bar in SharePoint Online

How to Hide Quick Launch in SharePoint Online?
The Quick Launch or left navigation located in the left side of the site typically contains links to resources located in the current site like lists and libraries, subsites, etc. To turn off quick launch in SharePoint Online, Go to:
  • Site Settings >> Click on "Navigation Elements" under Look and Feel
  • Un-Check "Enable Quick Launch" and Click OK.
    sharepoint online disable quick launch bar
This removes quick launch in SharePoint Online.

SharePoint Online: How to hide left navigation using SharePoint Designer?
You can also hide quick launch in SharePoint Online from SharePoint Designer. Just open the site in SharePoint designer and Un-check "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://crescenttech.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 left navigation bar in SharePoint Online, use this PnP PowerShell:
#Config Variables
$SiteURL = "https://crescenttech.sharepoint.com/sites/marketing"

#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -Credentials (Get-Credential)

#Get the Web
$Web = Get-PnPWeb

#Disable Quick Launch
$web.QuickLaunchEnabled = $False
$web.Update()
Invoke-PnPQuery
Here is another approach: Hide SharePoint Online Quick Launch using CSS

No comments:

Please Login and comment to get your questions answered!

Powered by Blogger.