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

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.

share|improve this question
    
do you want to get all list items with specific fields? not returning the fields but rather the items themselfs? –  ali Sharepoint Mar 12 '13 at 13:59
    
Yes, the items, but only with certain columns/fields. –  PeterX Mar 13 '13 at 1:39
add comment

1 Answer

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>";
share|improve this answer
    
Yes, so it seems you can't avoid the CamlQuery when fetching specific fields? –  PeterX Mar 13 '13 at 1:39
    
I think - yes :) –  Alexander Mar 13 '13 at 8:08
    
Don't forget about the CreateAllItemsQuery static function on the CamlQuery object: msdn.microsoft.com/en-us/library/… –  Cameron Verhelst Mar 14 at 9:12
add comment

Your Answer

 
discard

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.