I'm able to successfully get back a list of Genres I have stored in Sharepoint. It's unofficially a TaxonomyCollection
I believe. The way the client object sends it back is kind of strange and difficult to take and put into another form. Maybe I am doing something wrong?
Here's the JSON I get back: (See items under Genres node). I want to get the Label
value for example. Looks pretty straight forward.
Now this is what actually comes back in the client object model.
This is just crazy, here's the code I wrote just to get the label for one genre:
var items = clientContext.Web.Lists.GetByTitle("Contacts").GetItems(itemsQuery);
//Execution code removed for brevity
Dictionary<string,object> g = ((Dictionary<string,object>)items.ToList()
.First()["Genres"]);
var g2 = g.ToList()[1];
var g3 = (object[])g2.Value;
var g4 = (object[])((Dictionary<string, object>) g3[0]).Values.ToArray();
var g5 = g4[1].ToString();
As you can see it's ugly and writing a linq statement to ultimately get all the labels is equally as ugly and difficult to write. I am thinking that I am doing it wrong. Any suggestions?