此 CAML 查询有任何明显的缺陷吗?
我正在通过 Web 服务 API 查询共享点列表。通过 API 调用服务需要发送表示 CAML 查询的 XmlNode
对象。其他一切都完全相同,这是我尝试发送的两个不同的查询(在发送到 API 之前通过 XmlNode
的 InnerXml
属性获得) :
<!-- 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>
我是 CAML 查询的新手,所以也许我遗漏了一些关于 In
语句如何工作的明显信息,但我查看过的所有示例似乎都具有这种精确的格式。
I am querying a sharepoint list via the web service api. Calling the service 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您使用的是哪个版本的 SharePoint? IN 元素似乎仅在 SharePoint 2010 中有效。(根据本文:http://www.lushpedia.com/post/Alternative-of-In-Clause-for-CAML-Query-for-SharePoint-2007.aspx )
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)