March 2008 Entries

Determining the template type of a list or web

When working with SPWeb objects and SPList objects... meaning most of the time, sometimes the need arises to find out what template the list or web was created from.

The property on the SPWeb is called WebTemplate, and will return a string with the prefix of the template, SPS, STS, MWS, PWS, etc, not including the configuration #x afterwards, but good enough when using a Feature stapler to turn things on when new sites are created.

For lists, there is an Enumeration for SPListTemplateType that has all of the List template types, useful when creating a new list in code, or making sure you have the right list type for say custom actions.


But in case you were in an XML file, and needed a list type:

AdminTasks 1200
Agenda 201
Announcements 104
Categories 303
Comments 302
Contacts 105
CustomGrid 120
DataConnectionLibrary 130
DataSources 110
Decision 204
DiscussionBoard 108
DocumentLibrary 101
Events 106
GanttTasks 150
GenericList 100
HomePageLibrary 212
InvalidType -1
IssueTracking 1100
Links 103
ListTemplateCatalog 114
MasterPageCatalog 116
MeetingObjective 207
Meetings 200
MeetingUser 202
NoCodeWorkflows 117
PictureLibrary 109
Posts 301
Survey 102
Tasks 107
TextBox 210
ThingsToBring 211
UserInformation 112
WebPageLibrary 212
WebPartCatalog 113
WebTemplateCatalog 111
WorkflowHistory 140
WorkflowProcess 118
XMLForm 115

Or you can go here, I listed above just in case MS site dissapears (as they do from time to time)

-DK