6

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?

6 Answers 6

4

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.

0
3

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.

3
  • Thank you, but is it possible to retain the folders in filtered view or all items are shown always flat?
    – Drake
    Commented Oct 13, 2010 at 9:49
  • Did you use Folder Content Types to achieve folder specific views?
    – Steve P
    Commented Oct 13, 2010 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
    Commented Oct 14, 2010 at 9:18
0

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

0

While I realize this response is very delayed, it may help the next person. I am understanding this question as follows: A filter has been applied to an attribute of a folder, and while the folders filter properly in the view, the contents of the folder do not display when a specific folder is accessed.

This is very easy. Modify the view, expand the Folders grouping, and under Show This View: select "in the top level folder". This applies the filter to the top level folder only. When selecting a folder to access it's contents, the filter doesn't apply, thereby showing the content inside.

0

Late to the party too, but I think the simplest answer is to adjust the view setting named "Folders" to "Show all items without folders". By default, items within a folder won't show if the folder doesn't meet the filter condition which technically in this case it doesn't. It's a standard example of unintuitive Microsoftware.

0

The easiest way to maintain a folder navigation for users, yet filter on metadata in columns in a list and still have all the items appear in the "folder", is to use document sets rather than folders in your library.

If you never heard of document sets, they are containers that are similar to folders (but they are NOT folders) with metadata and inheritance, that users treat just like folders- they put documents into the document sets. The files inherit the metadata from the set, and when filters are applied, the files appear inside the sets.

You can read more about content sets and how to set them up here: https://support.microsoft.com/en-us/office/create-and-manage-document-sets-c71d5796-d559-48de-b1b3-42383bdd13ea

Now, you can have your Folder-like containers AND filters/views that show all the files, too!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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