Pergunta

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?

Foi útil?

Solução

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.

Outras dicas

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.

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

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.

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a sharepoint.stackexchange
scroll top