I have a list with a "Person or Group" field that allows both people or groups.

Is it possible to have a CAML query that gets items where the current user is in that field? It would also have to check if the user is in a group that is in the field.

Say I have a security group called "team" with "user1" in it. And in the list I have an item where the field value is "user2; team". Then if "user2" or "user1" access the list they should see that item but "user3" should not.


You can use the Membership query element. https://msdn.microsoft.com/en-us/library/office/aa544234(v=office.14).aspx

The following example defines a filter for cases where the user is either assigned a task based on membership in a group or assigned a task directly.

  <Membership Type=\"CurrentUserGroups\">
    <FieldRef Name=\"AssignedTo\"/>
    <FieldRef Name=\"AssignedTo\"></FieldRef>
    <Value Type=\"Integer\">
| improve this answer | |
  • Well this is brilliant! Let me give this a whirl. – IMTheNachoMan Oct 4 '16 at 3:25
  • Hope it helped :) – Nsevens Oct 4 '16 at 4:50
  • Actually its more of a separate question so let me ask a new one. – IMTheNachoMan Oct 4 '16 at 12:27
  • You can in the second part using Neq, but I'm not aware of anything for the first part. Not entirely sure what's possible for Membership tag... – Nsevens Oct 4 '16 at 12:27

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.