List Template Types
We have been discussing various parts of features and solutions and how you can use them to efficiently build your SharePoint business solution. One of the most basic things is to create a list template that instances can base themselves on. To begin your list template feature you need to create a ListTemplate element. This element has many attributes that define your list. One of the most important of these is the Type attribute. In the MSDN documentation it states that this is
"Optional Integer. Provides a unique identifier for the template. This identifier must be unique within the feature, but need not be unique across all feature definitions and site definitions. It then lists the built in template types and the type of list that they correspond to:
100 - Custom List
101 - Document Library
102 - Survey
103 - Links List
104 - Announcements List
105 - Contacts List
106 - Events List
107 - Tasks List
108 - Discussion Board
109 - Picture Library
110 - Data Sources
111 - Site Template Gallery
113 - Web Part Gallery
114 - List Template Gallery
115 - XML Form Library
120 - Custom Grid for a list
200 - Meeting Series List
201 - Meeting Agenda List
202 - Meeting Attendees List
204 - Meeting Decisions List
207 - Meeting Objectives List
210 - Meeting Text box
211 - Meeting things to bring list
212 - Meeting Workspace Pages List
300 - Portal sites list
1100 - Issue Tracking
2002 - Personal Document Library
2003 - Private Document Library
It then states that this value corresponds to the Type attribute of the List element.
We have been having some problems with this actually working, though. We built out some lists using the Visual Studio extensions for WSS and we wanted to place some list event receivers on a specific list. Well according to the extensions you should be able to do this by adding the event receivers to the .cs files for that list instance. We tried that and the event receivers were on every custom list. So we poked into the XML for the list instances and found that all of them were using type 100 or (Custom list). So we tried changing them to a different numbers in the 800 range, such as 800, 801, 802, etc. When we tried to deploy the new solution and check the list we received an HRESULT error, which most people know are some of the most unhelpful errors you can get in SharePoint. So we changed the numbers back and then re-deployed and the lists worked fine again.
The documentation says that it needs to be a unique integer across the feature. All of ours were and yet they did not work. If anyone has more insight as to how these list templates really work, feel free to leave a comment explaining them.
Labels: features, list templates, ListTemplate, MOSS 2007