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.

Advertisements
This entry was posted in SharePoint 2010, SharePoint 2013 and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s