I have used structural navigation in my site.In site settings->Navigation,while specifying the url,I am not able to pass query string along with url. Example: http://sitecollection/page.aspx is accepted whereas http://sitecollection/page.aspx?k=hr is not working.While passing the query string along with url,query string is getting ignored.Can anyone suggest the root cause of this problem? Is this a sharepoint behaviour in terms of navigation?

1 Answer 1


Write code as below:

string url = " http://sitecollection/page.aspx>k=hr";
string title = "HR";

SPNavigationNodeCollection quickLaunch = web.Navigation.QuickLaunch;
SPNavigationNode newnode = new SPNavigationNode(title, url, true);

or another method is:

var newNode = new SPNavigationNode("HR", "http://sitecollection/page.aspx");
newNode = web.Navigation.QuickLaunch.AddAsFirst(newNode);
newNode.Properties.Add("NodeType", "AuthoredLinkPlain");
newNode.Properties.Add("UrlQueryString", "k=hr");

You need to set the IsExternal property to true. After that it will start accepting query string or the second method which will add query string property to property bag.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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