0

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 ?

1
  • 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

1

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>
1

Try this:

<Where>
      <Eq>
         <FieldRef Name='FileLeafRef' />
         <Value Type='File'>file_name.txt</Value>
      </Eq>
   </Where>

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.