views:

24

answers:

1

Hi,

I'm trying to display a certain folder's content using the Content Query Webpart. While I'm perfectly able to display either all files in the document library (parent of the folder) or just the folder(s), I fail to understand how you would display a certain folder's content. Can anyone please enlighten me?

A: 

I've had this same problem, and it's rather frustrating. There doesn't appear to be an easy way to query on the folder path. If you enter the full folder path into the query location, it doesn't get you what you want and often defaults to the whole site. So, I've found two possible ways to achieve what you may be looking for, depending on your other requirements:

1) Instead of using folders, use separate Document Libraries. This may work if you have a limited number of "folders", but the site may quickly become difficult to manage with 50+ Document Libraries.

2) Add a custom column to your Document Library that can identify documents in the location that you're looking for. In my case, I only had one folder that I needed queried from the home page, so I added a Yes/No (Boolean) custom column named "Home Page Link". For all of the documents in the specific folder, I set the Home Page Link value to "Yes". If your solution requires querying more than one folder, you might think about adding a custom column named "Folder", which would then require you to enter the folder name or entire folder path as the attribute value for each document. This could quickly get difficult to manage and maintain, but it does provide an attribute which you can query on. Once you have the attribute set up, add it as a filter to your view or your Content Query WebPart and you'll get a query of just the specific files with that attribute value. If you use a View, select the "Show all items without folders" option to get the right output.

I hope that helps. Maybe SP 2010 will have some improvements on this.

Michael