I have sharepoint site and i want read in code global navigation information.
On properties page:
/_layouts/AreaNavigationSettings.aspx
I added “location”,”organization”,”98″ nodes.

But when i am trying to get those nodes in code
using (var site = new Microsoft.SharePoint.SPSite(URL))
{
using (var currentWeb = site.OpenWeb())
{
return currentWeb.Navigation.GlobalNodes;
}
}
I have always those nodes:
- Home
- Quick launch
- SharePoint Top Navbar
Why i have those strange nodes and how to get real globan naviigation/?
SharePoint’s navigation is hierarchical. The hierarchy has exactly three nodes:
You have to delve into subnodes of these node to find your three nodes — see the
SPNavigationNode.Childrenproperty. SharePoint lacks unique identifiers for navigation nodes so you have to rely on titles (display names).UPDATE: Also please note that your code contains a serious design flaw. You are returning an object that’s logically nested within a
SPWebout of the scope where theSPWebinstance is alive—i.e. out of theusingstatement. While this may work for navigation nodes generally such behavior will lead to errors. Those errors are often handled internally by SharePoint and result ‘only’ in logged error messages, but that’s definitelly what your code should produce.