Skip to main content
Tweeted twitter.com/#!/StackSharePoint/status/148952355503734784
added 192 characters in body
Source Link
JohnDoDo
  • 1.2k
  • 4
  • 21
  • 41

I'm trying to add some menus to the "Quick Launch" navigation and it does not work. I'm using the following code:

var ql = myWeb.Navigation.QuickLaunch;
SPNavigationNode m1 = new SPNavigationNode("MainMenu", "");
ql.AddAsLast(m1);
                               
SPNavigationNode m2 = new SPNavigationNode("OptionMenu", @"http://www.google.com", true);

ql[ql.Count - 1].Children.AddAsLast(m2);
ql[ql.Count - 1].Update();

I can't for the life of me understand what the issue is. No menu is shown.

If I look with power-shell at the QuickLaunch I see the "MainMenu" and the "OptionMenu" in the navigation but nothing is displayed. The IsVisible property is true.

Any hints?

I'm trying to add some menus to the "Quick Launch" navigation and it does not work. I'm using the following code:

var ql = myWeb.Navigation.QuickLaunch;
SPNavigationNode m1 = new SPNavigationNode("MainMenu", "");
ql.AddAsLast(m1);
                               
SPNavigationNode m2 = new SPNavigationNode("OptionMenu", @"http://www.google.com", true);

ql[ql.Count - 1].Children.AddAsLast(m2);
ql[ql.Count - 1].Update();

I can't for the life of me understand what the issue is. Any hints?

I'm trying to add some menus to the "Quick Launch" navigation and it does not work. I'm using the following code:

var ql = myWeb.Navigation.QuickLaunch;
SPNavigationNode m1 = new SPNavigationNode("MainMenu", "");
ql.AddAsLast(m1);
                               
SPNavigationNode m2 = new SPNavigationNode("OptionMenu", @"http://www.google.com", true);

ql[ql.Count - 1].Children.AddAsLast(m2);
ql[ql.Count - 1].Update();

I can't for the life of me understand what the issue is. No menu is shown.

If I look with power-shell at the QuickLaunch I see the "MainMenu" and the "OptionMenu" in the navigation but nothing is displayed. The IsVisible property is true.

Any hints?

Source Link
JohnDoDo
  • 1.2k
  • 4
  • 21
  • 41

Programmatically add menus to SPWeb.Navigation.QuickLaunch does not work

I'm trying to add some menus to the "Quick Launch" navigation and it does not work. I'm using the following code:

var ql = myWeb.Navigation.QuickLaunch;
SPNavigationNode m1 = new SPNavigationNode("MainMenu", "");
ql.AddAsLast(m1);
                               
SPNavigationNode m2 = new SPNavigationNode("OptionMenu", @"http://www.google.com", true);

ql[ql.Count - 1].Children.AddAsLast(m2);
ql[ql.Count - 1].Update();

I can't for the life of me understand what the issue is. Any hints?