SharePoint 2010: Site exporting as WSP solution (Part 1)
Note: this blog post is based onexperiences with the SharePoint 2010 Technical Preview version.
In the good old days of SharePoint 2003 and 2007 it was possible to save a site as a template. These sites were saved as .stp files, I assume this acronym stands for SiteTemPlate, a non-documented closed format that did not allow for modification in the saved template files. so new sites could be created based on the template. SharePoint 2010 promises the possibility to save a site as a WSP package, the Windows SharePoint Services Package format that we all love in the development of our SharePoint solutions, because it promises seamless deployments through the farm.
In this series of blog posts I will investigate the power of this new functionality, and take you, the reader, along the way in trying to answer the following questions that directly pop up into my mind:
- Is the site really exported as a WSP? And how does it look like at the inside?
- If we create a new site based on the template, do changes to content types at the site collection level propagate to the content types in the new instance of the site template?
- In Moss2007 it was not possible to export a publishing site as a site template. Well, actually you could, but it was not supported. Probably because pages and content a site publishing site depends on, like master pages, pages layouts, the style library and site collection images are managed at the site collection level (in the root site of the site collection). Did this change in 2010, and how is it handled?
- What is exported. The complete configuration of the site, or only changes to the site with respect to the initial site definition?
- Can we learn some new stuff on authoring WSP’s from the generated WSP’s?
- Visual Studio SharePoint Support has a project type “Import SharePoint Solution Package”, what does that do? Can we use the WSP generated by a saved site template?
Ok, let get started. The first steps to execute are:
- Create a site based on the blank site definition
- Export the site
To showcase some of the new tools in the mean time I will use SharePoint Designer to create our new site:
- Connect to the portal, and select the Subsites tab
- Create a new site named wspexport based on the Blank Site template
- This brings us a blank site:
To inspect some of the export functionality we create a custom list MyList with a Title and Description field, and a document library MyDocuments. We put some entries in the custom list and add a document to the document library. I assume that everyone knowing something about SharePoint knows how to do this.
Adding a simple Dummy.txt document to the document library:
The home page after adding list view web parts for the MyDocuments and MyList:
- We go back to SharePoint Designer, set the site Title and Description of the site and save as template
- Selecting Save as template brings you to the web site where you can specify the template site settings
When save as template is done we get to the following screen:
- Following the user solution gallery will bring us to the Solution Gallery. This is a location where solutions can be uploaded and downloaded. These solutions can probably be solutions that can include code that will be run in a sandbox. More on this in an upcomming blog post.
- Right-click on the WspExportSite and select Save Target As… to save the WSP file to your location of choice.
- Note that the saved solution can be activated by selecting the arrow next to its name
This concludes the first post in this series. What do we have:
- A WSP file on disk based on Blank Site containing a list and a document library
- A solution in our solution gallery ready to be activated
Disclaimer: All information in this blog post is based on my personal interpretation of information collected at the SharePoint Conference 2009 and experiences with SharePoint 2010 Technical Preview version provided to my company in the PEP program.