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", "");

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 think Navigation codes are different between Publishing and Team site. I can't confirm it. Go a quick Google. – Mike conway Dec 19 '11 at 15:18

I figure your problem is that you have not specified URL for MainMenu. As you notice all links in QuickLaunch has link associated with it. Specify a Url and it should work (I tested that locally).

| improve this answer | |
  • perfect. is there any way to query straight (direct access) if i want to get items in those list that linked? – saber tabatabaee yazdi May 6 '14 at 6:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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