CAML query to get task assigned  to current logged in user
I want to know the CAML query to get tasks assigned to the currently logg
November 26th, 2012 7:30am

Hi,

Here is query to get current user tasks:

<Where>
<And>
<Eq>
<FieldRef Name=AssignedTo></FieldRef><Value Type=Integer><UserID Type=Integer /></Value>
</Eq>
<Neq>
<FieldRef Name=Status/>
<Value Type=Text>Completed</Value>
</Neq>
</And>
</Where>

Hope it could help

Free Windows Admin Tool Kit Click here and download it now
November 26th, 2012 8:29am

You can use the membership element and the userid element to get tasks directly assigned to or through a group of the current logged in user.

<Or>
  <Membership Type='CurrentUserGroups'>
    <FieldRef Name='AssignedTo'/>
  </Membership>
  <Eq>
    <FieldRef Name='AssignedTo'></FieldRef>
    <Value Type='Integer'>
      <UserID/>
    </Value>
  </Eq>
</Or>

November 27th, 2012 10:35pm

Hi,

Have you resolved you problem? If yes then could you please provide your solution so other can take benefit of that or if above post help you to resolve your problem then mark it as answer.
Free Windows Admin Tool Kit Click here and download it now
December 21st, 2012 9:38am

Hi,

This is the query that worked for me

<Where>
<And>
<Or>
<Membership Type=CurrentUserGroups>
<FieldRef Name=AssignedTo />
</Membership>
<Eq>
<FieldRef Name=AssignedTo  LookupId=TRUE />
<Value Type=Lookup>123</Value>
</Eq>
</Or>
<Neq>
<FieldRef Name=Status />
<Value Type=Text>Completed</Value>
</Neq>
</And>
</Where>

Regards,

Nishant Rana

September 11th, 2013 5:32pm

Hi, for SP2010 I had to change Assigned To field:  show field: Name and used CAML Below  in query override for CQWP.    Use regex \n  and replace carriage returns as well this can break the web part from loading correctly.

<Where>

<Neq>

<FieldRef Name='Status' />

<Value Type='Choice'>Completed

</Value></Neq>

<Or><Membership Type='CurrentUserGroups'>

<FieldRef Name='AssignedTo'/>

</Membership>

<Eq><FieldRef Name='AssignedTo'>

</FieldRef><Value Type='Integer'>

<UserID/></Value>

</Eq>

</Or>

</Where>


Free Windows Admin Tool Kit Click here and download it now
April 11th, 2015 10:55am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics