0

I am trying to get the ListItems from a generic List with normal/standard Items in it.

I have following query:

   <Where>
      <Eq>
         <FieldRef Name='ContentType' />
         <Value Type='Computed'>0x01009653DF73CE10F94C8FCF852C8217FAC0</Value>
      </Eq>
   </Where>
   <ViewFields>
      <FieldRef Name='ContentType' />
   </ViewFields>

I have seen the Content Type of the ListItems via debugging my TimerJob with which I am looping through a List an get the Content Type of each ListItem.

But as soon as I put it in in a CAML query in CAML Designer 2013 and select my list to execute my query on I get no result returned from CAML.

Is there a known issue with the content Types and CAML or am I missing anything?

2

The only problem with you I am seeing is <FieldRef Name='ContentType' />. This should be like <FieldRef Name='ContentTypeId' />.

You are specifying the ID of Content Type. So you should use the Field name as ContentTypeId instead of ContentType

Or else try with specifying Content Type Name instead of Id as shown below

<Where>
      <Eq>
         <FieldRef Name='ContentType' />
         <Value Type='Computed'>Content Type Name</Value>
      </Eq>
   </Where>
   <ViewFields>
      <FieldRef Name='ContentType' />
   </ViewFields>

I recently gone through this problem and I got solution as I specified.

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.