Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I added a custom column called Project (string) to a Document List. I then set different views in different pages to filter on that column.

The problem is that, when applying the filter, documents stored inside folders are not shown even if the value of the Project column corresponds to the one set in the filter.

Do you know how to solve this problem?

share|improve this question

3 Answers 3

up vote 4 down vote accepted

Based on your last comment

I create a webpart to show the Document List on a certain page, and then I applied a filter on a column content to show only certain documents. But in that way the folder structure is lost and all documents are shown flat.

I think I can answer your your question now.

If you create a new view and select in the filter section

Content Type Equals Folder

OR

And then add the additional condition you wish to apply to the documents.

In this way folders will always be displayed but their contents will be filtered based on the additional constraint.

This will cause folders to be displayed whether or not they contain any children matching the additional constraint but you will be able to navigate the hierarchy.

share|improve this answer
    
Hey Steve, brilliant solution, thanks a lot! –  Drake Oct 20 '10 at 12:31

If you created the view in code you will need to specify the Scope="Recursive" ViewAttribute

Some examples are given here

http://sharepointmagazine.net/technical/development/writing-caml-queries-for-retrieving-list-items-from-a-sharepoint-list

If you created the views with the SharePoint UI you will need to

  1. Modify the view.
  2. Expand the "Folders" section in the Edit View page
  3. Select "Show all items without folders"

This will perform a recursive query.

share|improve this answer
    
Thank you, but is it possible to retain the folders in filtered view or all items are shown always flat? –  Drake Oct 13 '10 at 9:49
    
Did you use Folder Content Types to achieve folder specific views? –  Steve P Oct 13 '10 at 13:06
    
I create a webpart to show the Document List on a certain page, and then I applied a filter on a column content to show only certain documents. But in that way the folder structure is lost and all documents are shown flat. –  Drake Oct 14 '10 at 9:18

Specifying ViewAttributes Scope='Recursive' does not seem to work, Rather the Scope property of SPView needs to be set to Recursive:

SPView view = list.Views.Add(“TestView”, fields, string.Empty, 100, true, false);
view.Scope = SPViewScope.Recursive;

Here is a complete example:

http://sharepointnadeem.blogspot.in/2012/02/create-view-to-show-all-items-without.html

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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