CAML查询抛出SoapServerException

时间:2011-02-15 15:04:34

标签: sharepoint sharepoint-2010 camlp4

这是一个例外:

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>

当我没有指定任何过滤器时代码有效......

1 个答案:

答案 0 :(得分:2)

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

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