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?


3 Answers 3


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

  • I tried that, but I am still getting 0 items back.
    – omega
    May 30, 2013 at 13:07
  • Nevermind, this worked, I just had another issue.
    – omega
    May 30, 2013 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.


Simpler CAML - items created by current user

query.Query = @"<Where>
                    <FieldRef Name='Author' />
                    <Value Type='User'><UserID/></Value>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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