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 use SharePoint 2010 RTM and now I'm trying to get SPListItem, which was checked out by current user, using code like this:

                query.Query = "<OrderBy>" +
                                "<FieldRef Name='Title'/>" +
                              "</OrderBy>" +
                            "<Where>" +
                                "<And>" +
                                    "<Eq><FieldRef Name='CheckoutUser' LookupId='true'/><Value Type='User'>" + SPContext.Current.Web.CurrentUser.LoginName + "</Value></Eq>" +
                                    "<Eq><FieldRef Name='LinkFilename' /><Value Type='Text'>" + strFileShortName + "</Value></Eq>" +
                                "</And>" +
            query.ViewAttributes = "Scope=\"Recursive\"";
            SPListItemCollection itemCol = spl.GetItems(query);

But itemCol is always empty. Any suggestions what can be wrong?

share|improve this question
  1. Try to use SPContext.Current.Web.CurrentUser.ID with Type='User'
  2. LinkFilename has 'Computed' type. For details:

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.