Usually for retrieve information from list without system fields we've use code like this:
clientContext.Load(logWorkItems,
items => items.Include(
item => item["Hours_x0020_spent"],
item => item["Issue"],
item => item["Date"]));
but now I have a lot of lists and I think its not good to write for each list it's own included fields one by one. Maybe it would be better to write flexible code for any list, but each of my ideas is't work.
Before loading collection of list items I'm loading list by title:
var list = context.Web.Lists.GetByTitle(listTitle);
context.Load(list);
context.ExecuteQuery();
May be there is a way to use collection list.Fields
for retrieving all field titles to some List<string>
, exclude from this list all of the system fields titles, and after that do some magic and include each non-system title to context.Load
method?
Thank you in advance