3
votes

I am using below CAML query but when I run,it returns all data from document library instead of only corresponding to the < Values> specified in the query

<Query>
<Where>
<In>
 <FieldRef Name='Entity_x0020_Served' />
<Values>
 <Value Type='Text'>Payment Solutions</Value>
 <Value Type='Text'>Third Party Processor</Value>
</Values>
</In>
</Where>
</Query>

Am I missing anything in this? Thanks, Rushikesh

1

1 Answers

3
votes

strong textSuch syntax would not work in SharePoint 2007, you would have to make it or(equals "Payment Solutions", equals "Third Party Processor"). Maybe something has changed in SPS2010, but I'd rather suggest you rewrite it in this form.

AND you don't add the Query element to your queries!

<Where> 
 <Or> 
  <Eq>
     <FieldRef Name='Entity_x0020_Served' /> 
     <Value Type='Text'>Payment Solutions</Value> 
  </Eq>
  <Eq>
     <FieldRef Name='Entity_x0020_Served' /> 
     <Value Type='Text'>Third Party Processor</Value> 
  </Eq>
</Or> 
</Where> 

Update Found out this is valid syntax in SPS2010 (http://msdn.microsoft.com/en-us/library/ie/ff625761.aspx). Anyway, you should strip out the Query element.