How do you add a new template to the 'Choose a View Format' screen

Category: sharepoint 2010 programming


SmartData2 on Fri, 07 Dec 2012 22:03:35

I am wondering if it is  possible to  add a new Format Template to the  'Choose a View Format' screen. For Lists there are things like Gantt view, standard  view, access, etc but I would like to add my own custom one.


Mike Smith MCT MVP on Sat, 08 Dec 2012 03:16:33

Well, let's start with what a view is. It is a web part page with a web part to display the view. The web part is usually the ListViewWebPart.

The life cycle of a view is:

  1. Visit the view creation page    _layouts/viewtype.aspx
  2. Display the view (and activate the view related Ribbon option)
  3. Edit the view

The view create page (viewtype.aspx) is pretty easy, it's just an ASPX page with code and you could add your new view type here. When the user clicks a type you can then redirect to a custom editor page that would create the web part page and add a ListViewWebPart and configure it.

The Display phase could be a problem as SP 2010 only recognizes a View as a web part page with exactly one web part and that web part must be a ListViewWebPart. If you need to do something beyond what can be done with a ListViewWebPart, this may be the deal breaker.

Edit the view... I've not seen how to redirect the user to a custom editor page.

So, I think it's possible, within limits.  What is it you want to do?

Mike Smith MCT MVP on Sat, 08 Dec 2012 03:26:03

Depending on what you want to do with your custom view, maybe creating a custom view style might be a better bet. The styles are stored in 14\template\global\xml\vwstyles.xml. (but it's not well documented)