If you've been using SharePoint Online, you may have noticed that the left-hand navigation menu (also known as the "Quick Launch") appears on team sites by default. While this menu can be useful for navigation, there may be times when you want to hide it.
Luckily, this can easily be done with a simple PowerShell script. In this post, we'll walk through the script, which allows you to hide the Quick Launch menu from a SharePoint Online site.
Before we get started, there are a few prerequisites that you will need:
- Site url.
- SharePointPnPPowerShellOnline Power Shell module.
- SharePoint Online Global Administrator or SharePoint Online Site Collection Administrator role in the tenant.
The script starts by defining a parameter $siteUrl which is the URL of the SharePoint Online site that you want to hide the quick launch from. The script then authenticates to the SharePoint Online site using the Connect-PnPOnline cmdlet and the -UseWebLogin parameter. This allows the script to interactively log in to the SharePoint Online site using a pop up.
Next, the script uses the Get-PnPWeb cmdlet to get the Web object of the site, and then it sets the QuickLaunchEnabled property to false. This disables the quick launch menu. The web.Update() method is then called to apply the changes, and the Invoke-PnPQuery cmdlet is used to run the update operation.
Once the script is executed, the quick launch menu will be hidden from the specified SharePoint Online site. You can toggle between hiding and showing the quick launch by changing the value of the QuickLaunchEnabled property from false to true, respectively.
In conclusion, this simple PowerShell script can save you time and effort in hiding the Quick Launch menu in SharePoint Online. By using the PnP PowerShell cmdlets, you can automate many SharePoint tasks and improve your productivity.
You can find more information about the SharePoint PnP PowerShell library and its cmdlets in the official documentation here.