How to “seed” default content into newly provisioned site definitions in SharePoint 2010?
-
16-10-2019 - |
Question
We have a publishing site definition that we have created in Visual Studio 2010. It is working great and provisions the sites just fine. We have a need to have starter content inside the sites. All sites will have the exact same content. So when I say content, think 30-40 Pages in a Page library that contain mainly Content Editors and Rich Text Fields. We want to create a sample site that a content editor can go through and create all the content. We then we want to get that content and seed it with all the new site collections we create with the site definition. The structure of all the sites should be exactly the same.
What is the best approach?
Some thoughts:
- Content Deployment jobs or Export/Import Content?
- Creating a console application that can export via the API all content into some kind of format from a site, then import it into a new site.
Solution
Good question.
No perfect answer.
You can use this tool : http://spdeploymentwizard.codeplex.com/ It is written by the famous SharePoint MVP Chris O'Brien. Internally, is used the content migration API. It may be a good solution.
Creating a console app from scratch that will do the import/export is quite difficult. There are so many different cases.
OTHER TIPS
And how about site template creation approach?
This will produce a sandboxed solution (wsp-file), which can be deployed to any other site.
Unfortunately, this approach is not always a good solution for localized or deeply customized sites, because it is very static (and maybe some other issues).
So, what else can you use:
1. XML modules
In SharePoint 2010, you can create Site Pages, List definitions, List instances, fill them with data, and deploy to target site - just using Visual Studio SharePoint Developer Tools. This way is much better, than template approach, if you are developing complex and localized solution.
For creating site pages, you will need to use "Module" elements.
2. SPGenesis framework
This codeplex project will simplify your development, especially if you have many Content types and custom lists. It allows you to create all the lists without xml, using C# code. Please, check out the project site: http://spgenesis.codeplex.com/