2

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?

3
  • Is there a relationship established between the lists like a lookup column? May 30, 2013 at 19:07
  • No relation. Plain list with 2 columns. SalesPeople and Region. SalesPeople column is populated with bunch of users. May 30, 2013 at 19:21
  • Oh sorry, I misread the question. May 30, 2013 at 19:41

2 Answers 2

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.

-1

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

        <Contains>
            <FieldRef Name="Initiators" />
            <Value Type="UserMulti">williams</Value>
        </Contains>
1
  • But what if there are two users named "williams, berry" and "williams, berrys"? You should always use the ID from the User Information List. May 31, 2013 at 2:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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