I'm trying to retrieve both a file's Id in its list, plus its ETag, using the following snippet;
using (var clientContext = new ClientContext(webUrl))
{
var results = clientContext.Web.Lists
.GetById(listId).RootFolder.Files;
clientContext.Load(results, files => files
.Include(file => file.ETag)
.Include(file => file.ListItemAllFields.Id));
clientContext.ExecuteQuery();
foreach (var file in results)
{
Console.WriteLine(file.ETag + " " + file.ListItemAllFields.Id);
}
}
However, I'm getting the following exception;
The query expression 'files => files.Include(new [] {file => file.ETag}).Include(new [] {file => Convert(file.ListItemAllFields.Id)})' is not supported.
Am I forming my query correctly? It seems that if I query for the ETag by itself, then the query works. And also, if I query for the ListItemAllFields.Id by itself, then the query works.
It's when they are both included in the one query that the failure occurs.