It seems the Client Object Model is stripping out the "query" part of a URL stored inside the NavigationNode elements. I am wondering if this is a bug or perhaps I am doing something wrong?

Consider the following example. Site navigation is configured with a single item under the global navigation called Affordability and a URL that contains ?FilterField1=ContentType&FilterValue1=Affordability at the end of URL for the All Items view:

var root = "https://server/sites/site/";
var ctx = new ClientContext(root);
var web = ctx.Web;
var nav = web.Navigation;
var bar = nav.TopNavigationBar;

// use the TopNavigationBar collection
Console.Write(bar[0].Title + "=" + bar[0].Url);
// outputs "Affordability=/sites/sites/Lists/List/AllItems.aspx"

It seems to strip off the actual filtering part of the URL. It is still present in the Navigation settings, and clicking the link in the Web UI works just fine. I understand I could create views for all the different filtering criteria - that isn't really what I am looking for though. I am curious to see if this is a bug in the Client Object Model (maybe I somehow have an old version?) or perhaps I doing something wrong?

1 Answer 1


Thanks to Oleg's post: http://www.thedotnotcorner.com/2012/12/12/add-a-query-string-parameter-to-spnavigationnode/

It seems that in a site with the Publishing feature enabled, the query string is stored in a separate property: UrlQueryString.

So to access the full Url+QueryString you would need: bar[0].Url+bar[0].Properties["UrlQueryString"]

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.