How to filter AssignTo column with current user “[Me]” if the value is a group of members ?
Actually I got this requirement as a Question about using [me] filters for Group Membership:
Consider I have a SharePoint Group created called “My Group” and I am a member of the group. I am adding an “Assigned To” column to a library and all users will be putting a GROUP name in that People/Group field (not individual names as each item is a team effort). Well the problem is that when I filter by “Assigned To” with [Me] as the filter SharePoint does not evaluate down to group membership level – so it would not show me anything unless my name was specifically selected the “Assigned To” field.
We can’t achieve this functionality in out-of-the-box, but you can achieve it by customizing the <ListViewXml> in SharePoint designer.
Here are the steps…
1) open the corresponding Aspx in Sharepoint Designer
2) In the source code, locate the ListViewXml tag
3) Inside this tag, locate the Where clause (begins with "<Where" and ends with "/Where>")
4) Replace the contents of this tag with the following:
<Where>
<Or>
<Membership Type="CurrentUserGroups">
<FieldRefName="AssignedTo"/>
</Membership>
<Eq>
<FieldRef Name="AssignedTo"/>
<Value Type="Integer">
<UserID Type="Integer"/>
</Value>
</Eq>
</Or>
</Where>
Save the page, and you're ready to go.
Comments
- Anonymous
September 03, 2012
The comment has been removed - Anonymous
February 13, 2014
I LOVE YOU!!! :D:D:D You''ve probably saved and made my day tomorrow. I have a demo, and I needed filtering, but was not able to set it up properly by myself this whole day. Thanks A LOT