Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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>" +
                            "</Where>";
            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 Answer 1

  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

 
discard

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.