I want to show only a particular folder in the right pane of a page using a WebPart in SharePoint Foundation 2010. Is this possible? When adding the WebPart, I could only add the document library. I didn't see a way to show only a subfolder there. I also looked at creating a view on the library, but don't see a way to filter for a folder in the view's filtering options. Is this possible?
EDIT:
I found this which mentions manually editing the markup of the WebPart to add a query for the folder to query for the folder name, but no matter what I try, it always says no documents found. I added the field FolderDirRef
to my viewable columns to make sure I had the proper folder specified, but I still get nothing. I've tried <Eq>
and <BeginsWith>
and tried changing the Value
tag's type definition from Lookup
to Text
and without specifying the type. If I add a new document, it gets uploaded to the document library root. Here's the way I'm specifying the query.
<BeginsWith>
<FieldRef Name='FileDirRef' />
<Value Type='Lookup'>/DocumentLibraryName/SubFolderIWant/</Value>
</BeginsWith>
EDIT 2:
I've changed the <View>
's Scope
property to RecursiveAll
as shown below. With no query defined, it shows ALL documents in ALL folders (as expected), but as soon as I specify a query of any kind, it breaks, and resorts so showing no documents at all. To be clear, the WebPart isn't generating an error. It's just saying no documents found.
EDIT 3:
Here's the full view definition
<View Name="GUID" MobileView="TRUE" Type="HTML" Hidden="TRUE" DisplayName="" Url="..." Level="1" BaseViewID="1" ContentTypeID="0x" ImageUrl="/_layouts/images/dlicon.png" Scope="RecursiveAll">
<Query>
<Where>
<Contains>
<FieldRef Name='FileDirRef' />
<Value type='Text'>2007</Value>
</Contains>
</Where>
<OrderBy>
<FieldRef Name="FileLeafRef"/>
</OrderBy>
</Query>
<ViewFields>
<FieldRef Name="DocIcon"/>
<FieldRef Name="LinkFilename"/>
<FieldRef Name="Modified"/>
<FieldRef Name="Editor"/>
<FieldRef Name="FileDirRef"/>
</ViewFields>
<RowLimit Paged="TRUE">30</RowLimit>
<Toolbar Type="Freeform"/>
</View>