I've just noticed that that there is a difference in result when searching for a list item with CAML Query and getting it by ID.
Following piece of code returns item with 100 FieldValues:
var item = sourceList.GetItemById(1);
ctx.Load(item);
await ctx.ExecuteQueryRetryAsync();
While the following piece returns only 97 FieldValues:
var queryTxt = $"<View><Query><Where><Eq><FieldRef Name=\"ID\" /><Value Type=\"Integer\">1</Value></Eq></Where></Query></View>";
var query = new CamlQuery()
{
ViewXml = queryTxt
};
var itemList = sourceList.GetItems(query);
ctx.Load(itemList);
await ctx.ExecuteQueryRetryAsync();
var item = itemsList.FirstOrDefault();
Is there anything I've missed?
Edit: If I invoke it like this, I also get 100 FieldValues
var queryTxt = $"<View><Query><Where><Eq><FieldRef Name=\"ID\" /><Value Type=\"Integer\">1</Value></Eq></Where></Query></View>";
var query = new CamlQuery()
{
ViewXml = queryTxt
};
var itemList = sourceList.GetItems(query);
ctx.Load(itemList);
await ctx.ExecuteQueryRetryAsync();
var item = itemsList.FirstOrDefault();
ctx.Load(item);
await ctx.ExecuteQueryRetryAsync();
ViewFields
in your CAML to get exactly the fields you need. With that many columns available, if you only need a handful of them, you're pulling down a much larger payload than you need. Plus, if you can figure out exactly which three were missing, you could specify those three inViewFields
to see if they still fail to be retrieved when explicitly requested. – willman Jan 20 '20 at 12:30