0

I added a content query web part to my team site collection, then i export it , and i modified the QueryOverride tag as follow:-

<OrderBy><FieldRef Name="Created" Ascending="FALSE"/></OrderBy>
<Where>
<Or>

 <And>


     <And>
          <And>
               <IsNotNull><FieldRef ID="{e6746432-6ed6-45a9-8f90-a46424a22ca9}"/></IsNotNull>
               <Eq><FieldRef ID="{e6746432-6ed6-45a9-8f90-a46424a22ca9}"/><Value Type="User"><UserID/></Value></Eq>
          </And>
          <And>
               <IsNotNull><FieldRef ID="{2384afb0-efaf-4284-80fa-d54ce90be415}"/></IsNotNull>
               <Neq><FieldRef ID="{2384afb0-efaf-4284-80fa-d54ce90be415}"/><Value Type="Choice">Closed</Value></Neq>
         </And>
     </And>


     <And>
     <IsNotNull><FieldRef ID="{d3d161e1-70ec-4651-b7e4-c47d36dea099}"/></IsNotNull>
     <Neq><FieldRef ID="{d3d161e1-70ec-4651-b7e4-c47d36dea099}"/><Value Type="Choice">Action</Value></Neq>
     </And>


 </And>





 <And>


    <And>

       <And>
           <IsNotNull><FieldRef ID="{795d2ee2-9f9d-42e6-a21d-f2e519e12d2c}"/></IsNotNull>
           <Eq><FieldRef ID="{795d2ee2-9f9d-42e6-a21d-f2e519e12d2c}"/><Value Type="User"><UserID/></Value></Eq>
      </And>
      <And>
           <IsNotNull><FieldRef ID="{ef10ffb5-7e0c-44ba-92c5-44b39957b447}"/></IsNotNull>
           <Neq><FieldRef ID="{ef10ffb5-7e0c-44ba-92c5-44b39957b447}"/><Value Type="Choice">Closed</Value></Neq>
      </And>

   </And>

   <And>
           <IsNotNull><FieldRef ID="{d3d161e1-70ec-4651-b7e4-c47d36dea099}"/></IsNotNull>
           <Neq><FieldRef ID="{d3d161e1-70ec-4651-b7e4-c47d36dea099}"/><Value Type="Choice">Action</Value></Neq>
   </And>


 </And>

</Or>
</Where>

After that i imported the web part inside my page, but i did not get any result, so can anyone adivce what is wrong with my CAML , now i am trying to get list items that match the following criteria :-

  1. have its column id {e6746432-6ed6-45a9-8f90-a46424a22ca9} = login user + its status != closed + its type !=Action

OR

  1. have its column id {795d2ee2-9f9d-42e6-a21d-f2e519e12d2c} = login user + its status != closed + its type !=Action

so can anyone advice if my CAML query have any thing wrong ?

0

Try to replace <UserID /> tag by UserID number (int).

Moreover, if you want to ensure that your query is correct, check the server response: if you receive a 400 Bad Request HTTP Error, then it's very probable that your query is malformed. If the answer is 200 OK, then you should check the rest of the code.

0

I would highly suggest using CamlDesigner. I don't want to go through your caml query because your formatting is horrendous. Please clean that up if you want us to look at it. Here is an example Caml Query i made with CamlDesigner on a random list

   <Where>
      <And>
         <Or>
            <And>
               <Eq>
                  <FieldRef Name='Created' />
                  <Value Type='DateTime'>
                     <Today />
                  </Value>
               </Eq>
               <IsNotNull>
                  <FieldRef Name='Edit' />
               </IsNotNull>
            </And>
            <Eq>
               <FieldRef Name='DocStatus' />
               <Value Type='Choice'>Pending</Value>
            </Eq>
         </Or>
         <IsNotNull>
            <FieldRef Name='Edit' />
         </IsNotNull>
      </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.