CSOMOffice 365PowerShellSharePoint Online

Delete Navigation (Top Navigation or Quick Launch Node) Using CSOM and PowerShell


A colleague asked me a script for deleting nodes from Global Navigation or from Quick Launch in a SharePoint Site. Before we get into the PowerShell script lets know about the Navigation (In General). The below image illustrates the navigation settings in a SharePoint Site


All the headings with folder signs are parent nodes and links are children i.e child nodes. The requirement for now is to remove the parent node which can be accomplished by enumerating the appropriate collections QuickLaunch and TopNavigationBar. Here is the full script

How to use this script? Copy paste the code in your script location for example C:\Scripts and follow the below steps. Warning: If you have deleted the node it can’t be restored.

$Credential = Get-Credential -Credential ‘admin@contoso.onmicrosoft.com’ – By doing this we can pass multiple site and node title and remove the nodes from different sites

I have removed few nodes from Top and Quick and the below image illustrates it. (Compare the preceding image)


In my next blog I will share few more scripts for SharePoint Online which may helps content managers to manage the site easily. Enjoy PowerShell!

Leave a Reply

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