1

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?

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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