Scenario:
Task list is one of the most commonly used list in sharepoint. But I think it is missing a view in which someone can filter what tasks are either directly assigned him or any of the Active Directory Group/SharePoint Group he belongs to.
Solution:
After some digging into CAML , I got the right CAML query for getting me exactly the same thing.
Code:
<Where>
<Or>
<Membership Type="CurrentUserGroups">
<FieldRef Name="AssignedTo"/>
</Membership>
<Eq>
<FieldRef Name="AssignedTo"></FieldRef>
<Value Type="Integer">
<UserID/>
</Value>
</Eq>
</Or>
</Where>
<OrderBy>
<FieldRef Name="Status"/>
<FieldRef Name="Priority"/>
</OrderBy>
2 comments:
This is a gem, Sandeep. Thank-you!
JR
Hey this works like a charm...But the only problem is, it does not show any items to the Site Collection Administrator or any user from the owners group as they are not a part of any group. Ideally items from all groups should be visible to the SCA. It would have been better had there been a provision for this as well!
Post a Comment