How to: Create a SP2010 view filtered by Group

We all know that it is easy to create a view that only displays list items to specific users. You just go into the views and create one filtered for (for example) Column “Assigned To” equals “[Me]”.

This is how the “My Tasks” view works anyway.

But what happens when you want to filter the list results by a group? What happens if you have for example, a SharePoint group called “Developers” and you want to create a view that displays items assigned to the members of that group?

It’s not that hard after all. But, it’s not out of the box either.

You will need to create a custom view (for example, “Developers”), filter it by [Me] as you would if you had wanted to filter for a single person, and open it up in the SharePoint Designer.

In the CAML that drives the view, locate the <Where> clause. There will be a <Eq> just under it. The default behaviour is that the view will only display tasks/items from the list that are assigned to the currently logged in user. You can replace your <Where> statement with the following:

<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>

  • Any tasks that are assigned to a group will only appear to a
  • person if that person is a member of that group. Good stuff. Also, tasks that are directly assigned to a person will also appear to that specific person’s list view.
MGR: the Intelogist

About MGR: the Intelogist

SharePoint Server developer, turned Sitefinity developer, turned Angular developer, turned SharePoint Online consultant, turned Unily consultant, turned O365 consultant... Never a dull moment!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> 

This site uses Akismet to reduce spam. Learn how your comment data is processed.