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

One thought on “Get All Tasks Assigned to ME or Group I am part Off

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s