0

I keep having the following exception when trying to execute the following CAML query. What's wrong with the WHERE clause?

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

  <GetListItems xmlns="http://schemas.microsoft.com/sharepoint/soap/">
     <listName>Lookup Map Layers</listName>
     <viewName />
     <query>
        <Query xmlns="">
           <Where>
              <And>
                 <IsNotNull>
                    <FieldRef Name="IsMobileLayer" LookupId="TRUE" />
                 </IsNotNull>
                 <Eq>
                    <FieldRef Name="Unavailable" />
                    <Value Type="Boolean">False</Value>
                 </Eq>
                 <Eq>
                    <FieldRef Name="IsMobileLayer" />
                    <Value Type="Boolean">True</Value>
                 </Eq>
                 <Gt>
                    <FieldRef ID="Modifield" />
                    <Value Type="DateTime" IncludeTimeValue="True">2017-03-23T15:58:23</Value>
                 </Gt>
              </And>
           </Where>
        </Query>
     </query>
     <viewFields>
        <ViewFields xmlns="">
           <FieldRef Name="Title" />
           <FieldRef Name="Unavailable" />
           <FieldRef Name="IsMobileLayer" />
           <FieldRef Name="Ordinal" />
           <FieldRef Name="LookupName" />
           <FieldRef Name="MobileLayerUrl" />
           <FieldRef Name="MobileLayerType" />
           <FieldRef Name="Modified" />
        </ViewFields>
     </viewFields>
     <rowLimit />
     <queryOptions>
        <QueryOptions xmlns="">
           <IncludeMandatoryColumns>FALSE</IncludeMandatoryColumns>
           <ViewAttributes Scope="Recursive" />
        </QueryOptions>
     </queryOptions>
     <webID />
  </GetListItems>
3

Change your Where to this below. You can only have two conditions within an And, so if you have more than two conditions, you have to nest the And tags.

Also, you spelled the field "Modified" incorrectly... it is spelled "Modifield" in your Where...

       <Where>
          <And>
             <IsNotNull>
                <FieldRef Name="File_x0020_Size" LookupId="TRUE" />
             </IsNotNull>
             <And>
               <Eq>
                  <FieldRef Name="_HasCopyDestinations" />
                  <Value Type="Boolean">False</Value>
               </Eq>
               <And>
                 <Eq>
                    <FieldRef Name="_HasCopyDestinations" />
                    <Value Type="Boolean">True</Value>
                 </Eq>
                 <Gt>
                    <FieldRef ID="Modified" />
                    <Value Type="DateTime" IncludeTimeValue="True">2017-03-23T15:58:23</Value>
                 </Gt>
              </And>
           </And>
         </And>
       </Where>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.