Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I want to build a CAML - Query using the IN - Tag. The queried Column is a lookup-field to a Title of another list. When I query using the text-property everything works fine:

   <Where>
      <In>
         <FieldRef Name='page' />
         <Values>
            <Value Type='Lookup'>page1</Value>
            <Value Type='Lookup'>page2</Value>
            <Value Type='Lookup'>page3</Value>
         </Values>
      </In>
   </Where>

This is giving me the wanted result: All rows with Lookups to page1, page2 oder page3 are returned.

When I try to achieve this using the IDs instead I get no results at all:

<Where>
      <In>
         <FieldRef Name='page' LookupId='True' />
         <Values>
            <Value Type='Lookup'>5</Value>
            <Value Type='Lookup'>4</Value>
            <Value Type='Lookup'>3</Value>
         </Values>
      </In>
   </Where>

I rechecked the IDs a dozen times. They are correct. When I change the query to multiple OR-Operations it works fine.

Is this a known limitation of SharePoint 2010 or do I just have to insert a "magic" word somewhere?

share|improve this question
3  
make Type='Integer' instead of Lookup: <Value Type='Integer'>5</Value>, –  Arsalan Adam Khatri Oct 30 '12 at 13:28
    
Thanks. Worked. The Caml Builder confused me there :) –  Ole Albers Oct 30 '12 at 13:30

1 Answer 1

up vote 5 down vote accepted

make Type='Integer' instead of Lookup: <Value Type='Integer'>5</Value>

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.