Click here to Skip to main content
16,020,315 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello,
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,
XML
<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>
</Where>


C#
I have a list having name "Metadata Values" which contains two columns

1.Metadata Name (which is a Lookup Column from Metadata List)
2.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.

Any help will be appreciable.

Thanks

Nitin


What I have tried:

For creating caml query I have used Caml designer but not able to generate proper caml query
Posted
Comments
Karthik_Mahalingam 29-Jul-16 8:20am    
use CAML query builder[^] to simulate the query and Test.
Beginner Luck 1-Aug-16 1:38am    
Do not do CAML yourself easy to error. I agree with top

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900