SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

    clientContext.Load(results, files => files
            .Include(file => file.ETag)
            .Include(file => file.ListItemAllFields.Id));

    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.

share|improve this question
up vote 3 down vote accepted

Managed to work this one out with a bit of trial and error. The correct form of the query is;

    files => files.Include(file => file.ETag),
    files => files.Include(file => file.ListItemAllFields.Id));

Hopefully that's of some use to anyone else who encounters this issue.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.