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; ctx.Load(nav); ctx.ExecuteQuery(); var bar = nav.TopNavigationBar; ctx.Load(bar); ctx.ExecuteQuery(); // use the TopNavigationBar collection Console.Write(bar.Title + "=" + bar.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?