Tuesday, November 29, 2016

How to build a CAML query with where clause?

We can SPUserField as SPLookupField

<Query> 
     <Where> 
         <And> 
              <Eq> 
                  <FieldRef Name='UserField'/> 
                  <Value Type='Lookup'>" + username + "</Value> 
              </Eq> 
              <Eq> 
                   <FieldRef Name='UserField' LookupId='True' /> 
                   <Value Type='Lookup'>" + ID + "</Value> 
              </Eq>
         </And> 
     </Where> 
 </Query> 

No comments:

Post a Comment