Get All Tasks Assigned to ME or Group I am part Off


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

http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/3bf657f8-1abd-4fa7-938b-e0b534499a72/

Working with Large Lists in SharePoint 2010 – List Throttling

Advertisements