0

I have a Library which hosts my document sets. As we all know, each document set actually creates a sub-folder, within the Library. So, now I have a structure similar to:

Root
  \___ Doc Set 1 (ID = 1)
          \________ Doc 1.docx
           \________ Doc 2.docx
   \___ Doc Set 2 (ID = 4)
          \________ Doc 3.docx
           \________ Doc 4.docx

I want to use an OOB XsltListViewWebPart to show the documents of a document set specified by its ID, on a page of mine. I have provisioned a custom view, which has a Scope=Recursive, which returns all the files of the library as a flat list. Now I just need to somehow filter the view by document set ID.

Unfortunately, seems like SharePoint doesn't support a token such as 'RootFolderId', there is just 'RootFolder' which is a server-relative path of the folder. But I only have ID (int) of the document set.

Question: What can I possibly use in the View's Query, in order to filter and return only the documents which are under the folder, specified by the folder int ID? Is there a way I can say in the CAML query: 'give me all files, where FileDirRef == (folder where ID = {ID}).FileLeafRef?

Alternatively, how can I configure the doc lib / document set content type, to propagate the document set ID to the documents which are under the document set? I can't believe there is no single way of correlating the documents under the doc set, to their parent, by iD.

I am well familiar with the ParameterBinding tag, however the most promising configurations of this tag (i.e. 'Form' and 'Control') only work on post-back.

1

I have come up with a solution! On the page, I place two web parts:

WP1 - XsltListViewWebPart shows the 'flat' view of the Document Library which contains the document sets. So it would show ALL* files within the doc lib, which satisfy a Query within the view, which basically says "give me all documents which contain the {Param} folder in their folder path".

WP2 - XsltListViewWebPart shows a view, which thanks to ParameterBinding tag, filters the document sets by a url query parameter - hence, it only 'shows' the document set for which I pass the param in the URL. I have configured this view to be Minimized and No Title, so it appears totally hidden on the page. But more importantly, it is CONNECTED to send row data to WP1. Basically, WP2 is limited to show a single document set and also configured to send this document set's Folder Name to WP1.

That's how I have configured the page to show me Documents, which belong to a document set determined by an ID passed in the URL.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.