4.3 Obtain Filtered List Data

The following is an example of a query for obtaining list data for all list items with an identifier greater than 1. To obtain the list data, but not list schema, the resultContent attribute is set to the value of "dataOnly". Filtering is achieved by setting the Where clause of the Query.

Request

<queryRequest xmlns="http://schemas.microsoft.com/sharepoint/dsp">
   <dsQuery select="/list[@id='{C13E4B16-9982-4C30-B533-2B4068B0C623}']" 
      resultContent="dataOnly">
      <Query>
         <Where>
            <Gt>
               <FieldRef Name="ID" />
               <Value>1</Value>
            </Gt>
         </Where>
      </Query>
   </dsQuery>
</queryRequest>

Response

<queryResponse xmlns="http://schemas.microsoft.com/sharepoint/dsp">
   <dsQueryResponse status="success">
      <Widgets xmlns="">
         <Widgets_Row>
            <ID>2</ID>
            <Title>Widget B</Title>
            <Count>100</Count>
            <Stock>0</Stock>
         </Widgets_Row>
         <Widgets_Row>
            <ID>3</ID>
            <Title>Widget C</Title>
            <Count>23</Count>
            <Stock>1</Stock>
         </Widgets_Row>
      </Widgets>
   </dsQueryResponse>
</queryResponse>