0


I have a site collection with some sites (Publishing theme).
I need to add some links to the top navigation bar and the quick launch by Powershell.

$web = Get-SPWeb "http://myurl"
$newLink = New-Object Microsoft.SharePoint.Navigation.SPNavigationNode -ArgumentList  @("test", "http://www.google.com");  
$web.Navigation.TopNavigationBar.AddAsLast($newLink);
$web.Update();

I tried this code,it runs fine, but I can not see the new link.
If I try to add a new link from the UI, I can not see it in the $web.Navigation.TopNavigationBar object.
It is working with an other template (ex team site)

8
  • 1
    Isn't the topbar a termset in publishing site? May 20, 2014 at 11:23
  • I don't know, what do you mean?
    – Nk SP
    May 20, 2014 at 11:26
  • Maybe it is hidden by the Masterpage. Check the CSS for "ms-breadcrumb-top"
    – hupseb
    May 20, 2014 at 12:02
  • Thanks, but I can not see them in the object so I do not think that is just a visualization problem :/
    – Nk SP
    May 20, 2014 at 12:11

1 Answer 1

0

Solved using the SharePoint 2013 Taxonomy.
These are the steps:
- Create a Term Set
- Setting site nav to use taxonomy

Tutorial: SharePoint 2013 Taxonomy

NB: I changed the Get-date format, this works for me $date = Get-Date -Format s

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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