Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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

1 Answer 1

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.