Filter a list by User or Group column in CAML Query [Membership]

New Contributor

Is there a way to filter a list by User or Group column?

I need to get all the tasks assigned to each user on a site.

I got the below code for now, but that only works if I'm trying to get my tasks.

Is there a way to pass a user ID to Membership Type so I can get the tasks of any user?

 

 <Where>
<Or>
<Membership Type=’CurrentUserGroups’>
<FieldRef Name=’AssignedTo’ />
</Membership>
<Eq>
<FieldRef Name=’AssignedTo’ LookupId=’TRUE’ />
<Value Type=’Lookup’>123</Value>
</Eq>
</Or>
</Where>

0 Replies