I am querying a sharepoint list via the web service api. Calling the ser开发者_如何学Cvice through the API requires sending an XmlNode
object that represent the CAML query. With everything else exactly the same, these are two different queries I'm attempting to send (obtained via the XmlNode
's InnerXml
property right before they are sent to the API):
<!-- This one works fine -->
<Query>
<Where>
<Eq>
<FieldRef Name="ID" />
<Value Type="Text">304</Value>
</Eq>
</Where>
</Query>
<!-- This one fails with a Soap exception (which I've seen before when searching
for an invalid field, but the first one calls the exact same field). -->
<Query>
<Where>
<In>
<FieldRef Name="ID" />
<Values>
<Value Type="Text">304</Value>
<Value Type="Text">303</Value>
<Value Type="Text">302</Value>
<Value Type="Text">301</Value>
</Values>
</In>
</Where>
</Query>
I'm new to CAML queries, so perhaps I'm missing something obvious about how In
statements work, but all the examples I've viewed seem to have this exact format.
Which version of SharePoint are you using ? The IN element seems to be valid only in SharePoint 2010. (According to this article: http://www.lushpedia.com/post/Alternative-of-In-Clause-for-CAML-Query-for-SharePoint-2007.aspx)
精彩评论