One of my coworkers, John Ross, recently asked me if it was possible to create a new Site Collection in SharePoint 2010 and use a custom site template for it. I'm usually more of a server and infrastructure guy, but this made me curious. In SharePoint 2007 site (really web) templates were saved as .STP files. Those STP files could be in the site collection gallery, or the farm gallery. If it was in the farm gallery then it was available at site collection creation. In SharePoint 2010 site (really web) templates are stored as user solutions in the site collection solution store as WSP files. Those WSP files don't upload at the farm level (at least not that I've been able to find). So how does one create a new site collection with a custom template? Stick around, we're going to find out. J
The first thing to keep in mind is that site collections don't have templates, webs do. When a new site collection is created there is a template picker. That doesn't apply a template to the site collection itself, but to the rootweb of that site collection. When the site collection is created, the rootweb is also created. That is where the template is applied. Knowing that, we can figure out a solution. We know that the site collection gets created, with or without a template. If the site collection is created, then so is its solution gallery. If we upload our WSP to that solution gallery, then it's available to us when we create the rootweb. That's how we create a site collection with a custom template. Here's the blow-by-blow on how to do it.
First we'll save out our site (really web) template. Start by going to the site you want to save as a template. Then go to Site Actions > Site Settings. It will look like this:
When you click "Save site as template" you see this screen (though it won't be filled out, you have to do that)
If things go well, you'll get this screen. Click the link to go to the Solution Gallery.
That should take you to this page:
Click the name of the template you created. You'll be greated with this dialog to save it to your local file system:
Now go into Central Administration and create the Site Collection (Application Management > Create site collections) you want to apply this template to. On the creation page go to the custom template page like below:
The secret sauce is not selecting a template for the rootweb. When the site collection is created, you'll be given a link to it. When you click it you'll be taken to the template picker page, if you hit it as one of the site collection administrators. At the bottom is a link to your newly created site collection's solution gallery.
Upload the template solution here:
Don't forget to activate it.
When you're back to the solution gallery use the breadcrumb to get back to the rootweb of the Site Collection:
That will take you back to the template picker page. Now on the Custom tab we have our template.
That's all there is to it.