Filter on current user and current user groups

SP2013

Hello everyone,

Today I’ll tell you about a request I often see on the forums, namely “How to display the content assigned to the current user.”

Where simple [me] is not enough that this request also target items assigned to user’s groups.

For this, two options are available to you

1) To use SharePoint Designer to modify the query on a webpart (example here : http://www.makdeniz.com/how-to-filter-sharepoint-2010-tasks-which-are-assigned-to-you-and-the-group-your-are-member-of/ )

2) To create a custom webpart filter that will dynamically filter your content. For that I return you to one of my previous post:

https://christopherclementen.wordpress.com/2012/04/02/filter-a-list-dynamically/

Whatever your choice, the query will be the following

<Or>

<Membership Type=”CurrentUserGroups”>

<FieldRef Name=”AssignedTo”/>

</Membership>

<Eq>

<FieldRef Name=”AssignedTo”/>

<Value Type=”Integer”>

<UserID/>

</Value>

</Eq>

</Or>

For more explanation on the creation of this query, I propose you two of my previous posts:

https://christopherclementen.wordpress.com/2012/03/12/filter-on-current-user-with-caml-query/

https://christopherclementen.wordpress.com/2012/08/27/caml-query-membership-attribute/

Hope this helps !

Christopher.

Leave a comment