- Part 1 – The Tools
- Part 2 – Exporting the Site
- Part 3 – Exporting the Lists
- Part 4 – Exporting the Site Columns and Content Types
- Part 5 – Wrap Up
Took a little longer to get to part 2 than expected with being gone last week on vacation and client work this week. Quick recap for everyone on what we’re trying to do here. Scenario would be that you’ve already built and customized a SharePoint site using the web UI (edit page, add web part, create list, create site columns, etc.) Now we want to be able to capture that site and put it into a SharePoint feature (and solution) so that we can easily re-deploy it say for disaster recovery, migrating between development environments, or any number of other needs.
For a reference on any of the tools to be used, please read part 1. The first thing you’ll want to do is create a WSPBuilder solution, preferably placing it under source control. My coworker Kelly Jones and I tossed around the idea of writing up a guide for how to create the infrastructure for setting up SharePoint development environment, perhaps someday you’ll see a post on that. For now though, check out this introduction to WSPBuilder or drop me a line if you need help getting started with WSPBuilder. Most of my experience with it has been hands on so I don’t have too many references for getting started with it.
Once you have your WSPBuilder solution created, we’ll use the SharePoint Solution Generator 2008. This tool will export our site into a Visual Studio solution to give us a starter base. Run the tool (on a SharePoint server in the farm, very important) and select Site Definition.
Next Select the site to be exported. In my case I wish to export the Messaging Site which is a subsite of Store Portal.
Once you have selected the site, you may choose to export lists contained on that site. I have chosen to export all of my lists but that is not necessary.
Last, select the location to output the generated solution file to and give it a name. I leave the defaults.
The solution generator will show you a progress bar and indicate any errors that may come up during the export process. I have yet to run into any errors in all my times using the tool.
Once the export has completed click on the link to open the folder containing the solution that was generated.
Taking a look at the solution file, we’ll see a couple of things. First is the site template folder. This contains all of the .aspx pages, the onet.xml (more on that in a later part of the series), and instances files for the lists exported. Note: files below were from a previous export, so you won’t see some of the same folders for lists.
You’ll want to place these files into your solution file similar to how I’ve done below. While you can copy in the list folders into your features folder, I’ve found that the MOSS Feature Generator does a better job encapsulating all of the required information in a much smoother fashion. So for now hold off on copying those list folders unless you’d like to toy around with how they work. You’ll want to rename some files (ListDefinition.xml becomes elements.xml, etc) and modify some values to be more in line with the defaults used by WSPBuilder.
There you have it, you’ve exported your site into a WSP Solution and with minimal effort. In part 3 I’ll dive into the MOSS Feature Generator and show you how to export your lists directly into feature folders. Part 4 will be the Imtech Fields Explorer and how to export site columns and content types. I’ve not yet planned out if there will be any further parts to this series beyond the four, but I imagine there will be at least a post or two more about advanced items. As always I appreciate any feedback, suggestions, questions, or comments from my readers. Let me know if there’s anything I can help with. Until next time.
-Frog Out
Originally posted on: https://briantjackett.com/archive/2009/07/08/exporting-a-sharepoint-site-into-a-feature-part-2-ndash.aspx#591746If you didn’t read first part, you will not understand this part.
LikeLike