这个获取异常的caml查询有什么问题“无法完成此操作.请再试一次"? [英] What is wrong with this caml query to get exception "can not complete this action. Please try again"?

查看:58
本文介绍了这个获取异常的caml查询有什么问题“无法完成此操作.请再试一次"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在对 SharePoint 列表实施 caml 查询!我有 5 个条件,我将每 2 个条件放在一个标签中.但它仍然得到这个异常:无法完成此操作.请重试!"

I am implementing a caml query on a SharePoint list! I have 5 conditions and I place every 2 condition in one tag. but It is still get this exception: "can not complete this action. please try again!"

<And>
    <Eq>
        <FieldRef Name='fieldName1' />
        <Value Type='Text' >value1</Value>
    </Eq>
    <And>
        <Contains>
            <FieldRef Name='fieldName2' />
            <Value Type='Text' >value2</Value>
        </Contains>
        <Contains>
            <FieldRef Name='fieldName3' />
            <Value Type='Text' >value3</Value>
        </Contains>
    </And>
    <And>
        <Eq>
            <FieldRef Name='fieldName4' />
            <Value Type='DateTime' IncludeTimeValue='false'>2019-06-22</Value>
        </Eq>
        <Eq>
            <FieldRef Name='fieldName5' />
            <Value Type='DateTime' IncludeTimeValue='false'>2019-05-06</Value>
        </Eq>
    </And>
</And>

我的查询有什么问题?

推荐答案

对于涉及多个字段的比较,它更像是自下而上的方法,您开始比较 2 个字段,然后是第 3 个字段的结果,然后是第 4 个字段的结果,依此类推在.所以,你的查询应该是这样的:

For comparisons involving multiple fields, it's more like bottom up approach, you start comparing 2 fields, then the result with 3rd field then the result with 4th field and so on. So, your query should be like:

      <And>
     <Eq>
        <FieldRef Name='fieldName1' />
        <Value Type='Text'>value1</Value>
     </Eq>
     <And>
        <Contains>
           <FieldRef Name='fieldName2' />
           <Value Type='Text'>value2</Value>
        </Contains>
        <And>
           <Contains>
              <FieldRef Name='fieldName3' />
              <Value Type='Note'>value3</Value>
           </Contains>
           <And>
              <Eq>
                 <FieldRef Name='fieldName4' />
                 <Value Type='Text'>value4</Value>
              </Eq>
              <Eq>
                 <FieldRef Name='fieldName5' />
                 <Value Type='Text'>value5</Value>
              </Eq>
           </And>
        </And>
     </And>
  </And>

这篇关于这个获取异常的caml查询有什么问题“无法完成此操作.请再试一次"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆