1

I want to create CAML Query for following scenario,

(Metadata Name ="Author1" AND Value="Nitin Jagtap") AND (Metadata Name ="Program" AND Value="MBA").

I have tried but not able to create CAML query for same. I have used CAML Designer for same but unable to get proper result.

     Following is the CAML Query which is generated by using CAML Designer but it is not giving results        
  <Where>
  <And>
     <And>
        <And>
           <Eq>
              <FieldRef Name='Metadata_x0020_Name' />
              <Value Type='Lookup'>Author 1</Value>
           </Eq>
           <Eq>
              <FieldRef Name='Value' />
              <Value Type='Text'>Nitin Jagtap</Value>
           </Eq>
        </And>
        <Eq>
           <FieldRef Name='Metadata_x0020_Name' />
           <Value Type='Lookup'>Program</Value>
        </Eq>
     </And>
     <Eq>
        <FieldRef Name='Value' />
        <Value Type='Text'>MBA</Value>
     </Eq>
  </And>

I have a list having name “Metadata Values” which contains two columns

  • Metadata Name (which is a Lookup Column from Metadata List)
  • Value (which is Single line of text column) The list “Metadata Values” contains multiple records for each Metadata Name having different- different values or same values.

How should I create proper CAML query, so it will gives proper results. Please guide me.

  • Is that really a valid scenario? You can not have f.e. Value equal both MBA and Nitin Jagtap. Should there be an OR between the parentesis instead? – Robert Lindgren Jul 29 '16 at 12:13
  • And the structure looks wrong too, I'd go back to CAML Designer and try configuring this again – Eric Alexander Jul 29 '16 at 12:20
  • Thanks Robert,for your reply.This is a valid scenario.Okay I will try using OR – nitin jagtap Jul 29 '16 at 13:00
0

Your query for Managed metadata(Multivalues) Column should be:

<FieldRef Name='Metadata_x0020_Name' />
  <values>
      <Value Type='Lookup'>Author 1</Value>
      <Value Type='Lookup'>Program</Value>
  </values>

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.