What's the best way to retrieve lookup values using ClientContext? I'm accessing a list using ClientContext (let's call it ParentList). That list contains several lookup fields (let's call one of them ChildId) pointing to other lists (call one of them ChildList). I'm currently using a ListItem to iterate over the results. Snippet:
ListItemCollection collListItem = oList.GetItems(camlQuery);
context.Load(collListItem,
items => items.Include(
item => item["title"],
item => item["id"]));
context.ExecuteQuery();
foreach (ListItem oListItem in collListItem)
{
allTrials.Add(new Trial
{
Name = oListItem["title"].ToString(),
Category = oListItem["id"].ToString(),
});
}
I don't have anything regarding the lookup values in it yet because I haven't been able to wrap my head around that. I'm assuming I'll need to use "FieldLookupValue", but haven't used that before.
Thx!