Tip – CAML Query Retrieve tasks assigned to user (including both AD and SP Groups)
This is something I have seen so many people struggle with, but it really is very easy, with the help of the “<Membership>” element.
The Membership element allows you to basically check to see if the AssignedTo field is assigned to any group which the current user is a member of.
Of course, you still need to use it in conjunction with a standard FieldRef check against the user’s ID (which you can get using the <UserID/> element.
Below is the CAML query to return All Tasks Assigned to the Current User, including specific assignments, and where the task is assigned to a group that contains the current user (both AD Groups and SharePoint Groups).
I suppose theoretically this should also work with groups in custom Membership Providers .. but haven’t tried it.
<FieldRef ID=’Assigned To’ />
<FieldRef Name=’AssignedTo’ />