I have document library in which several folders, in one of them I have sub-folder that I need to display in custom view. So, position of that folder is like Doc.Library > Folder2 > Internet.
I found several examples how to display Folder instead of whole Library in custom view, with help of CAML query in SPD2013.

Here is what I have in my custom view:

        <FieldRef Name="FileRef"/>
        <Value Type="Text">Internet</Value>

Now comes part which gives me problem, with this query, I get blank page, no documents are visible. If I put Folder2 instead of Internet I see documents but I see all documents of Folder2 folder, which I don't need.
So, my question is how can I manage to show Internet folder only?

I tried several other options, instead of Text to put Lookup, FileLeafRef instead of FileRef, etc. but none were successful.

  • Where you are using that caml query? c#? Mar 15, 2017 at 13:59
  • I am using it in .aspx page of Custom view I created for that folder.
    – Danilo
    Mar 15, 2017 at 14:26

2 Answers 2


If you are using c#, then you can use the following code

List DocumentsList = clientContext.Web.Lists.GetByTitle(list);
CamlQuery camlQuery = new CamlQuery();
camlQuery = new CamlQuery();
camlQuery.ViewXml = @"<View Scope='RecursiveAll'>
                                    <FieldRef Name='FileDirRef'/>
                                    <Value Type='Text'>
                        <RowLimit Paged='TRUE'> 30 </RowLimit>
ListItemCollection listItems = DocumentsList.GetItems(camlQuery);

Ref Click Here

  • Thanks for effort and your time. I voted your answer as useful.
    – Danilo
    Mar 15, 2017 at 15:06

With minor changes I solved problem.
Instead of FileRef I put FileDirRef. For View I added Scope="RecursiveAll" and for Value I put relative address.

        <FieldRef Name="FileDirRef"/>
        <Value Type='Text'>/sites/sitename/subsitename/DocLibraryName/folderName/SubFolderName</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.