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: Disable Quick Launch using PowerShell:
#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
}

Enable quick launch using 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

#Enable Quick Launch
$web.QuickLaunchEnabled = $True
$web.Update()
Invoke-PnPQuery

Here is another approach: Hide SharePoint Online Quick Launch using CSS
SharePoint Online: How to Disable Quick Launch Bar using PowerShell? SharePoint Online: How to Disable Quick Launch Bar using PowerShell? Reviewed by Salaudeen Rajack on April 19, 2018 Rating: 5

No comments:

Please Login and comment to get your questions answered!

Powered by Blogger.