I have a CAML query to find documents by name within a document library, however, the checked out (drafts) documents are not found by the below query (ran with high privilege):

Spquery query = new Spquery(){
RowLimit = 1,
Query = "<WHERE><EQ> <FieldRef Name='FileLeafRef'/><Value Type='Text'>file_name.txt</Value> </WHERE></EQ>

What I am missing, how can I include the checked out items ?

  • When you say checked out files you mean the files which are never checked in to the system or the files which were checked in some time before and then checked out?
    – Harsh
    Commented Aug 3, 2021 at 14:18

2 Answers 2


Try substitute Type="Text" to Type="File", to be like this:

<WHERE><EQ> <FieldRef Name='FileLeafRef'/><Value Type='File'>file_name.txt</Value></WHERE></EQ>

Try this:

         <FieldRef Name='FileLeafRef' />
         <Value Type='File'>file_name.txt</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.