locked
Sharepoint 2010: Global navigation : add link using powershell RRS feed

Answers

  • this is not so straightforward and simple as may look. And PowerShell is a really less problem here comparing with other technical issues. The problem is that initially Sharepoint don't store navigation items for the site - instead it calculates them and caches automatically. So it is not so simple to add item to the collection if there is no physical collection. When you add some nodes via Site settings > Navigation - Sharepoint creates collection of items so after that adding of new items is more simple. I recommend you to check gl-addnavigationnode command code from Garry Lapointe: investigate the code in reflector. After you will understand how it works - it will be simple to add the nodes via PowerShell or whatever.
    Blog - http://sadomovalex.blogspot.com
    CAML via C# - http://camlex.codeplex.com
    • Marked as answer by Seven M Friday, June 10, 2011 3:25 AM
    Friday, June 3, 2011 10:35 AM

All replies

  • this is not so straightforward and simple as may look. And PowerShell is a really less problem here comparing with other technical issues. The problem is that initially Sharepoint don't store navigation items for the site - instead it calculates them and caches automatically. So it is not so simple to add item to the collection if there is no physical collection. When you add some nodes via Site settings > Navigation - Sharepoint creates collection of items so after that adding of new items is more simple. I recommend you to check gl-addnavigationnode command code from Garry Lapointe: investigate the code in reflector. After you will understand how it works - it will be simple to add the nodes via PowerShell or whatever.
    Blog - http://sadomovalex.blogspot.com
    CAML via C# - http://camlex.codeplex.com
    • Marked as answer by Seven M Friday, June 10, 2011 3:25 AM
    Friday, June 3, 2011 10:35 AM
  • Hi ,

    Thanks for your answer: In Global navigation there are 2 things: one add Folder and add Link.

    Using UI we are able to add Folder and Link ( First or more...),

    Using Powershell we are abel to add folder, so there should be way out.

    ============\

    The work around of this problem is:

    1. Add folder on top, and hide it.

    2. Now we have first node, ( Add the links to this object). and we are done.

    --- Tx Labhesh

     


    Labhesh Shrimali
    Monday, June 13, 2011 9:11 AM
  • Hi,

    as mentioend in my above post. you can find the code here...

    http://2020sharepoint.wordpress.com/2011/06/13/add-node-to-global-navigation-using-powershell/ 

    -Tx

    Labhesh


    Labhesh Shrimali
    Monday, June 13, 2011 9:52 AM