Export of a Subsite of one Portal to a different Portal
While there are multiple way to backup / export and restore / import a SharePoint site, I tried to summarize few of the most frequently used approaches here:
Approach #1: Through Content Deployment Wizard (UI) – Easy Way
Approach #2: Through STSADM (command prompt) – For automation purpose.
Approach #3: Through your own program – For customized export and import.
Way #1: Easy Way
One easy way is to use Sharepoint deployment wizard from codeplex.
There are also other ways like:
- 1. Ave Point’s Doc Ave
- 2. SharePoint Site Migration Manager by Metalogix
- 3. STSADM
Here I am providing some screen shots with Sharepoint deployment wizard from codeplex.
Figure 1: Exporting Content
Figure 2: Select action (import or export) and provide site URL:
Figure 3: For export, use the tree view to select which content you wish to deploy. On container objects such as webs, there are options about whether descendent objects should be included:
Figure 4 Complete Export
Figure 5: Browse to the .cmp file we exported in the previous steps, and select options around security, versions and, importantly for some scenarios, whether object IDs should be retained:
Figure 6: The details are shown back for confirmation, and when ‘Finish’ is clicked the import will begin:
And that’s the gist of it. This is the first beta of the tool and I’m sure there will be issues. Regardless, when using any tool which makes this kind of change to your data you should always take a backup before performing the import. Depending on what you’re doing, it could be difficult to revert back to the previous state otherwise.
Some other notes:
- the tool must be installed locally on the server which hosts the site
- not all features of the Content Migration API are supported by the tool
Way #2: Automated Way
We can consider using this way to create the batch files which could be used in automating the deployment process.
stsadm.exe -o export
-url <URL to be exported>
-filename <export file name>
1 – Last major version for files and list items (default)
2 – The current version, either the last major or the last minor
3 – Last major and last minor version for files and list items
4 – All versions for files and list items]
[-cabsize <integer from 1-1024 megabytes> (default: 25)]
Way #3: Through your own program
SPSite site = new SPSite(“http://localhost:2000”);
SPWeb web = site.OpenWeb(“/SomeWeb”); // This is the sub site.
SPExportObject exportObject = new SPExportObject();
exportObject.Id = web.ID;
exportObject.IncludeDescendants = SPIncludeDescendants.All;
exportObject.Type = SPDeploymentObjectType.Web;
SPExportSettings settings = new SPExportSettings();
settings.SiteUrl = “http://localhost:2000″;
settings.ExportMethod = SPExportMethodType.ExportAll;
settings.FileLocation = @”c:\export”;
settings.FileCompression = false;
settings.ExcludeDependencies = false;
SPExport export = new SPExport(settings);