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 have created a external content type (BCS list) in SharePoint. I am using the below code in order to get items from bcs list.

SPQuery query = new SPQuery();
query.Query = "<Where><IsNotNull><FieldRef Name='BdcIdentity'/></IsNotNull></Where>";
SPListItemCollection col = list.GetItems(query);

Also I have created a view for the list. Can anyone tell me how to get items from the view of the list?

Thanks

share|improve this question

2 Answers 2

You could modify the Query Attribute of your View to include your Query, instead of retreiving the elements yourself with the SPQuery

<Query>
  <Where>
     <IsNotNull>
         <FieldRef Name='BdcIdentity'/>
     </IsNotNull>
  </Where>
  <OrderBy>
    <FieldRef Name="SOMEFIELDTOORDERBY"/>
  </OrderBy>
</Query>
share|improve this answer

You can for example use the column name of the list.

Going through the list:

 foreach (SPListItem item in col)
 {
     Object o = item["column name"];
 }
share|improve this answer

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.