Below is the CAML Query to get All the task assigned to me or the group I am part of. And only tasks which are not complete.
<Query>
<GroupBy Collapse=”TRUE” GroupLimit=”50″>
<FieldRef Name=”AssignedTo”/>
</GroupBy>
<OrderBy>
<FieldRef Name=”Created” Ascending=”FALSE”/>
</OrderBy>
<Where>
<And>
<Or>
<Membership Type=”CurrentUserGroups”>
<FieldRef Name=”AssignedTo”/>
</Membership>
<Eq>
<FieldRef Name=”AssignedTo”/>
<Value Type=”Integer”>
<UserID/>
</Value>
</Eq>
</Or>
<Neq>
<FieldRef Name=”Status”/>
<Value Type=”Text”>Completed</Value>
</Neq>
</And>
</Where>
</Query>
<ViewFields>
<FieldRef Name=”Created”/>
<FieldRef Name=”LinkTitleNoMenu”/>
<FieldRef Name=”Status”/>
<FieldRef Name=”Title”/>
<FieldRef Name=”ID”/>
<FieldRef Name=”WorkflowLink”/>
</ViewFields>
</Query>
Some cool SPQuery Links
http://mosswat.blogspot.com/2009/03/spquery-syntax.html
http://www.codebanking.com/articles/sharepoint/construct-sharepoint-caml-query.asp
How to Set Null Values to Query
Working with Large Lists in SharePoint 2010 – List Throttling
Can you please suggest me how to get all the tasks that are not assigned to particular group as well users within that group(Using CAML query).
To be more specific say there is a group called “Managers” in AD and five users within that group. I need to get all the task that are not assigned to any of the users within this Manager group. I tried with the below query, but it didnt work out as per my expectation
“Completed”
The above query returned tasks that are assigned to Current User group as well.