How to display a specific folder in a document library (within a webpart in Sharepoint 2010)?

Isa picture Isa · Mar 14, 2013 · Viewed 16.1k times · Source

I have seen examples doing this with Page Viewer, which works. But the problem is page viewer is so slow (it adds at least 10 seconds to page load, and it freezes for another 15 when I click on it before it starts acting like a folder). I am sure users will be frustrated when they see this, so I'd rather display it in list view like the document library webpart.

The key goal is to display a subfolder within a document library on a wiki-page as a webpart that is navigable. If coding is required, that's ok as long as it is allowable by content editor. (I am a newbie on this, so directions on the how-s will be highly appreciated!)

Thanks!

Edit: I stumbled across [this]: Sharepoint: How do I filter a document library view to show the contents of a subfolder? after I posted, but I am completely lost after reading the "solution". If someone can explain what it means, or some kind of step by step instruction, that will be helpful...

Answer

Chris Boyd picture Chris Boyd · Jul 29, 2015

One way I've found is to open the page in Sharepoint Designer and modify the actual code of the document web part placed on that page.

You'll find the document web part, look for the query line, and add/modify it to include this:

<where>
    <contains>
        <FieldRef Name="FileDir" />
        <Value Type="Lookup">[Name of Folder]</Value>
    </contains>
</where>

Make sure to replace [Name of Folder] with the name of the directory within your document library for your site that you want to point towards. Also, make sure to change the View of the web part to look for folders, not files, so that you start at the top level of the structure you are looking for.