Working With Folder Specific Views in SharePoint Lists
One neat feature in SharePoint that I recently discovered is the ability to specify views specific to folder based content types in a list.
What’s great about this is that if you’re building a hierarchical store in a list with folder based content types, then you can have each level of the hierarchy display different views.
As an example, consider a school district.
They may map their classes like this:
- School A (Folder based CT)
- Grade A1 (Folder Based CT)
- Class A1.1 (Folder Based CT)
- Student A1.1.1 (Item Based CT)
- Student A1.1.2
- Class A1.2
- Grade A2
- School B
- Grade B1
- Grade B2
Now for each of the folder based content types, you can specify a view specific to that content type by using the DefaultViewForContentType=”TRUE” and ContentTypeID attributes of View. For example, on the Grade level view, when a user selects a Grade, I would want to show a column called “Teacher” because in this view, I’m showing Class items. However, at the School level, “Teacher” doesn’t make sense as a column.
Now none of this is all very difficult to figure out, however there are a few notes:
- To get this to work, you have to specify these values for EVERY view. If you don’t, you will see that at each level of the hierarchy, you will have the view available, but the navigation will not automatically select that content type specific view.
- For the default view, you need to add it as 0x012001.
This is a great tip as it creates for a much better end-user experience by allowing them to have contextual views based on the current content type.