Retrieve Tasks assigned to a user or current user groups in SharePoint using CAML query

This CAML SharePoint tutorial explains how to retrieve tasks assigned to a user or current user groups in SharePoint using CAML query.

Follow the below steps:

Open your site in SharePoint designer 2010. Go to List and Libraries option. Select your Task List to see in fig.

Retrieve Task assigned to a user or current user groups in SharePoint using CAML query

Open the task list in advance mode or .aspx extension file. Find the view tag under this <Query> option. Change by the following code only under the <Query> tag

<View Name=……
<Query>
<Where>
<Or>
<Membership Type="CurrentUserGroups">
<FieldRef Name="AssignedTo" />
</Membership>
<Eq>
<FieldRef Name="AssignedTo" />
<Value Type="Integer">
<UserID Type="Integer"/>
</Value>
</Eq>
</Or>
</Where>
</Query>

Save and check out the page.

You may like following SharePoint CAML tutorials:

This is how we can retrieve task assigned to a user or current user groups in SharePoint using CAML query in SharePoint 2010. The same CAML query we can use in SharePoint 2013/2016 or SharePoint Online also.

Donwload Hub site pdf

Download SharePoint Online Tutorial PDF FREE!

Get update on Webinars, video tutorials, training courses etc.

  • I m trying following CAML query but its not working throwing an error.

    whats wrong in this?can anyone help, I want to display list items which having value in Column Vendor same as name of users sharepoint group

  • If it do not work with “CurrentUserGroups”, try replacing it with “SPWeb.Groups”. Like below.

    This is what worked for me in SP2013.

  • >