CAML 查询抛出 SoapServerException

发布于 2024-10-17 15:15:10 字数 2034 浏览 3 评论 0原文

这是例外:

Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown.

这是 CAML 代码:

<Query>
 <Where>
  <And>
   <And>
    <And>
      <And>
        <And>
          <And>
            <And>
              <Contains>
                <FieldRef Name="Title">
                  <Value Type="Text">password</Value>
                </FieldRef>
              </Contains>
              <Contains>
                <FieldRef Name="Answer">
                  <Value Type="Note">pass</Value>
                </FieldRef>
              </Contains>
            </And>
            <Eq>
              <FieldRef Name="PubDestination1">
                <Value Type="Text">PCOM</Value>
              </FieldRef>
            </Eq>
          </And>
          <Eq>
            <FieldRef Name="PubDestination2">
              <Value Type="Text">2</Value>
            </FieldRef>
          </Eq>
        </And>
        <Eq>
          <FieldRef Name="FaqCategory">
            <Value Type="Text">Autenticação</Value>
          </FieldRef>
        </Eq>
      </And>
      <Eq>
        <FieldRef Name="PublicComponent">
          <Value Type="Boolean">1</Value>
        </FieldRef>
      </Eq>
    </And>
    <Geq>
      <FieldRef Name="PubStartDate">
        <Value Type="DateTime" IncludeTimeValue="TRUE">2011-02-07T00:00:00Z</Value>
      </FieldRef>
    </Geq>
  </And>
  <Leq>
    <FieldRef Name="PubStartDate">
      <Value Type="DateTime" IncludeTimeValue="TRUE">2011-02-25T00:00:00Z</Value>
    </FieldRef>
   </Leq>
  </And>
 </Where>
</Query>

当我不指定任何过滤器时,该代码可以工作...

This is the exception:

Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown.

Here's the CAML code:

<Query>
 <Where>
  <And>
   <And>
    <And>
      <And>
        <And>
          <And>
            <And>
              <Contains>
                <FieldRef Name="Title">
                  <Value Type="Text">password</Value>
                </FieldRef>
              </Contains>
              <Contains>
                <FieldRef Name="Answer">
                  <Value Type="Note">pass</Value>
                </FieldRef>
              </Contains>
            </And>
            <Eq>
              <FieldRef Name="PubDestination1">
                <Value Type="Text">PCOM</Value>
              </FieldRef>
            </Eq>
          </And>
          <Eq>
            <FieldRef Name="PubDestination2">
              <Value Type="Text">2</Value>
            </FieldRef>
          </Eq>
        </And>
        <Eq>
          <FieldRef Name="FaqCategory">
            <Value Type="Text">Autenticação</Value>
          </FieldRef>
        </Eq>
      </And>
      <Eq>
        <FieldRef Name="PublicComponent">
          <Value Type="Boolean">1</Value>
        </FieldRef>
      </Eq>
    </And>
    <Geq>
      <FieldRef Name="PubStartDate">
        <Value Type="DateTime" IncludeTimeValue="TRUE">2011-02-07T00:00:00Z</Value>
      </FieldRef>
    </Geq>
  </And>
  <Leq>
    <FieldRef Name="PubStartDate">
      <Value Type="DateTime" IncludeTimeValue="TRUE">2011-02-25T00:00:00Z</Value>
    </FieldRef>
   </Leq>
  </And>
 </Where>
</Query>

The code works when I don't specify any filters...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

圈圈圆圆圈圈 2024-10-24 15:15:10

Value 元素不应位于 FieldRef 元素内。您应该将 FieldRef 和 Value 放入一个父元素中(如 Contains):

  <Contains>
    <FieldRef Name="Title"/>
    <Value Type="Text">password</Value>
  </Contains>

Value element should not be inside FieldRef element. You should put both FieldRef and Value into one parent element (like Contains):

  <Contains>
    <FieldRef Name="Title"/>
    <Value Type="Text">password</Value>
  </Contains>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文