I have around 150 sub sites in a particular SharePoint 2013 O365 Site Collection. How to add a new Top Link Navigation on all sub sites in easy way? I want to add the link of Site Collection on all these 150 sub sites without manually going to Navigation settings in each sub site.

  • Your subsites inherit navigation from root level or not? Jan 4, 2018 at 6:54
  • No, they are not inheriting. Jan 4, 2018 at 13:25
  • are you more comfortable in C# or PowerShell as we can use any of the mentioned technique to solve your issue. Jan 5, 2018 at 11:16
  • Hi, i read the your comment on below mentioned answer. There can be only two ways to do same (preferred). One is inherit from the parent site. If you are fine with this, then you need to update all your sub sites to inherit from root level site. Other solution will be, use Managed Metadata to create your navigation. So in all your subsite, point to the single managed metadata term store to create navigation. And a final solution (not the preferred) can be, write a script to add navigation to all the sub sites. It can be a console based application or can be a WPF based application. Jan 5, 2018 at 11:21
  • Which solution you would like to go with? Jan 5, 2018 at 11:22

3 Answers 3


I assume that the subsites does not inherit the topnavigation.. So you have to script it somehow. I usually use powershell with CSOM to script SharePoint online..

To connect powershell CSOM copy the Microsoft.SharePoint.Client.dll and Microsoft.SharePoint.Client.Runtime.dll to the scriptfolder and then connect to the sitecollection.

$siteUrl = <url to your sitecollection>
$username = <username>
$password = <password>
add-type -Path ".\Microsoft.SharePoint.Client.dll"
add-type -Path ".\Microsoft.SharePoint.Client.Runtime.dll"
$clientContext = New-Object Microsoft.SharePoint.Client.ClientContext($siteUrl)
$securePassword = ConvertTo-SecureString $password -AsPlainText -Force 
$clientContext.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $securePassword)
$site = $clientContext.Site;

Then you can see this to get ideas on the rest of the script

Set global navigation items through CSOM - C#

The most important thing to remember is:

  • Load information
  • ExecuteQuery
  • Thanks for your response. My requirement is to add a new link to all the subsites, I don't actually find how to do it like we use "Add link" in Structural Navigation on Site Settings->Navigation page. I don't want to disturb the existing settings for Global/Current Navigation in the subsites. Jan 4, 2018 at 13:33

You can perform below PowerShell command :

if(!(Get-PSSnapin Microsoft.SharePoint.PowerShell -ea 0))
Add-PSSnapin Microsoft.SharePoint.PowerShell
$root=Get-SPWeb "http://sp"
if($root.Webs.Count -gt 0)
    foreach($web in $root.Webs)
        $nodeColl = $web.Navigation.TopNavigationBar
                    $node=New-Object Microsoft.SharePoint.Navigation.SPNavigationNode("Google", "https://www.google.com")                
  • I have tried the above but I get "Get-SPOSite : The site xxx is not properly formed." error. Jan 17, 2018 at 14:51
  • Mine is SharePoint Online site, that's why I have used Get-SPOSite and tried using SharePoint Online Management Shell. But still no luck Jan 17, 2018 at 16:09

if your links need to be displayed on all pages you can add them to the master page

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.