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 have a list with a "People and Groups" type column and multiple selection allowed is checked. Another column call "Region"

Say, I have John, doe and barry, williams in the "SalesGuy" column and Region is SW.

How do I do a CAML query where only want to pass 1 user john, doe or barry, williams and get the region back?

share|improve this question
    
Is there a relationship established between the lists like a lookup column? –  PirateEric May 30 '13 at 19:07
    
No relation. Plain list with 2 columns. SalesPeople and Region. SalesPeople column is populated with bunch of users. –  Brittany Leigh May 30 '13 at 19:21
    
Oh sorry, I misread the question. –  PirateEric May 30 '13 at 19:41

2 Answers 2

Contains is not exact - what happens if you have multiple Williams?

        <Where>
           <Includes>
              <FieldRef Name='Initiators' LookupId='TRUE'/>
              <Value Type='Integer'>7</Value>
           </Includes>
        </Where>

Where 7 is the ID of the SPUser of Williams.

share|improve this answer

The answers is Contains. Also, if i put williams, berry it works.

        <Contains>
            <FieldRef Name="Initiators" />
            <Value Type="UserMulti">williams</Value>
        </Contains>
share|improve this answer
    
But what if there are two users named "williams, berry" and "williams, berrys"? You should always use the ID from the User Information List. –  RJ Cuthbertson May 31 '13 at 2:47

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.