SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want a caml query that only retrieves items created by the user currently logged in. I tried this

specifier = "<Eq><FieldRef Name='AssignedTo'/><Value Type='Integer'><UserID/></Value></Eq>";
camlquerystring = "<View><Query><Where>" + specifier + "</Where><OrderBy><FieldRef Name='Modified' Ascending='FALSE' /></OrderBy></Query></View>"; 

However I am not getting any items. I should be getting a lot of items...

Does anyone know the right way to do this?


share|improve this question
up vote 3 down vote accepted

AssignedTo should be replaced with Author and you should then see all your items.

share|improve this answer
I tried that, but I am still getting 0 items back. – omega May 30 '13 at 13:07
Nevermind, this worked, I just had another issue. – omega May 30 '13 at 13:58
SPQuery query = new SPQuery();
query.Query = @"<Where><Eq><FieldRef Name='Author' LookupId='TRUE' /><Value Type='Integer'>" + _id + @"</Value></Eq></Where><OrderBy><FieldRef Name='Created' Ascending='False' /></OrderBy>";

where _id is user's ID.

share|improve this answer

Simpler CAML - items created by current user

query.Query = @"<Where>
                    <FieldRef Name='Author' />
                    <Value Type='User'><UserID/></Value>
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.