Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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?

share|improve this question
    
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
add comment

1 Answer 1

up vote 5 down vote accepted

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).

share|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 at 6:44
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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