1

Is it possible to get all items from a single list (getting specific fields) without using a CamlQuery? If I try to use context.Load(oList, ...), I can't use the Include method as the List class doesn't implement the Include method.

I've seen examples that use a ListCollection, but I'm only using one list.

2
  • do you want to get all list items with specific fields? not returning the fields but rather the items themselfs? Commented Mar 12, 2013 at 13:59
  • Yes, the items, but only with certain columns/fields. Commented Mar 13, 2013 at 1:39

1 Answer 1

1

If I'm not wrong you can use empty CamlQuery.

CamlQuery camlQuery = new CamlQuery();
camlQuery.ViewXml = "<View/>";

For performance issue the common practice is to use view fields to reduce response data.

camlQuery.ViewXml = 
    @"<View>
        <ViewFields>
          <FieldRef Name='PartLookup' LookupId='TRUE' />
          <FieldRef Name='PartLookupSKU' />
          <FieldRef Name='PartLookupTitle' />
          <FieldRef Name='PartLookupDescription' />
          <FieldRef Name='BinNumber' />
          <FieldRef Name='Quantity' />
        </ViewFields>
      </View>";
3
  • Yes, so it seems you can't avoid the CamlQuery when fetching specific fields? Commented Mar 13, 2013 at 1:39
  • I think - yes :) Commented Mar 13, 2013 at 8:08
  • Don't forget about the CreateAllItemsQuery static function on the CamlQuery object: msdn.microsoft.com/en-us/library/… Commented Mar 14, 2014 at 9:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.