sharepointcaml

CAML Query For Author Field


I need caml query to search list items by author id number. I tried

<View>        
    <Query>      
       <Where>    
         <FieldRef LookupId="True" Name="Author"/>    
         <Value Type="User">  MyIdNumber </Value>    
       </Where>              
    </Query>    
</View>

Also i tried Type="Integer", Type="Lookup" insted of Type="User". Nothing works. Exception message is This action couldn't completed. Could you help me


Solution

  • You missed <Eq></Eq> in Your camlquery. Please try to use following caml

    <View><Query><Where><Eq><FieldRef Name='Author' LookupId='True'/><Value Type='Lookup'>MyIdNumber</Value></Eq></Where></Query></View>