Partager via


List 'Save as template' functionality & WSS Site Definitions...

I recently had to make some changes/additions to a customers custom site definitions. As everyone should know, the way to go about this is to "hide" your V1 site definitions by using the Hidden="TRUE" attribute in the WebTemp.xml file, take a copy of your V1 definitions and modify those. As part of this you will need to give your V2 definitions a new TemplateID ... as you cant have 2 site definitions that have the same ID.... Fair enough i thought.

As it turns out, the act of changing the site ID has a interesting side effect as i found out. When you save a List as a template the file manifest file in that saved list template has a TemplateID. This refers to the TemplateId of the site definition that was used to create the site that the list was on. 

So after we installed the new site definitions we noticed something. The saved list templates were not showing up in the "Create" page for new sub-sites ... but were for the existing sites (the ones based off the old site definitions)

What happens is the Create page only shows templates for lists that have the TemplateID set to the template ID of the current web.

I can see some reasoning behind this... but only a little.

That list might depend on other lists that were provisioned as part of that particular site definition. However, there is nothing stopping anyone giong any deleting those lists afterwards ... and breaking the list that depends on it...

... so why bother only allowing lists to be created from list templates that were saved from a site that was based on the same site definition (and thus TemplateID) as the site that you are trying to create the list on? Anyone?