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

%3CLINGO-SUB%20id%3D%22lingo-sub-2252172%22%20slang%3D%22en-US%22%3EFilter%20a%20list%20by%20User%20or%20Group%20column%20in%20CAML%20Query%20%5BMembership%5D%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2252172%22%20slang%3D%22en-US%22%3E%3CP%3EIs%20there%20a%20way%20to%20filter%20a%20list%20by%20User%20or%20Group%20column%3F%3C%2FP%3E%3CP%3EI%20need%20to%20get%20all%20the%20tasks%20assigned%20to%20each%20user%20on%20a%20site.%3C%2FP%3E%3CP%3EI%20got%20the%20below%20code%20for%20now%2C%20but%20that%20only%20works%20if%20I'm%20trying%20to%20get%20my%20tasks.%3C%2FP%3E%3CP%3E%3CSTRONG%3EIs%20there%20a%20way%20to%20pass%20a%20user%20ID%20to%20Membership%20Type%20so%20I%20can%20get%20the%20tasks%20of%20any%20user%3C%2FSTRONG%3E%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3CWHERE%3E%3CBR%20%2F%3E%3COR%3E%3CBR%20%2F%3E%3CMEMBERSHIP%20type%3D%22%E2%80%99CurrentUserGroups%E2%80%99%22%3E%3CBR%20%2F%3E%3CFIELDREF%20name%3D%22%E2%80%99AssignedTo%E2%80%99%22%3E%3C%2FFIELDREF%3E%3CBR%20%2F%3E%3C%2FMEMBERSHIP%3E%3CBR%20%2F%3E%3CEQ%3E%3CBR%20%2F%3E%3CFIELDREF%20name%3D%22%E2%80%99AssignedTo%E2%80%99%22%20lookupid%3D%22%E2%80%99TRUE%E2%80%99%22%3E%3C%2FFIELDREF%3E%3CBR%20%2F%3E%3CVALUE%20type%3D%22%E2%80%99Lookup%E2%80%99%22%3E123%3C%2FVALUE%3E%3CBR%20%2F%3E%3C%2FEQ%3E%3CBR%20%2F%3E%3C%2FOR%3E%3CBR%20%2F%3E%3C%2FWHERE%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Visitor

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