Tuesday, September 2, 2008

Setting Current Navigation programatically

In the MOSS UI you can set Current Navigation to any of these options:

  • Display the same navigation items as the parent site
  • Display the current site, the navigation items below the current site, and the current site's siblings
  • Display only the navigation items below the current site
But if you wantto do it programatically how can you?

The default is "Display the current site, the navigation items below the current site, and the current site's siblings" so you dont need to care, when adding a web.

Hope this helps for other options, and you dont need to loose time looking and testing.

//Sets Current Navigation to Display the same navigation items as the parent site
pubWeb.InheritCurrentNavigation = true;
pubWeb.NavigationShowSiblings = false;
pubWeb.Update();

//Sets Current Navigation to Display only the navigation items below the current site
pubWeb.NavigationShowSiblings = false;
pubWeb.Update();
}

No comments: