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?
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
<BeginsWith> and tried changing the
Value tag's type definition from
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>
I've changed the
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.
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>