Content Migration API in Action

Content deployment works well when a clear connection between the source farm and the destination farm is always available. However, a reliable, functional connection between a source authoring farm and a destination production farm is not always available. For example, geographic barriers, firewalls that prevent access, or network outages are all situations in which using a network connection to transport an export package to a destination production farm is not reliable. In these situations, Microsoft recommends that you work with the Microsoft Office SharePoint Server 2007 object model and the Microsoft Windows SharePoint Services 3.0 Content Migration API to programmatically complete the export and import steps of content migration and find an alternative way to transport the export package to the destination production farm and then run the custom import code.

Above is from the article How to: Customize Deployment for Disconnected Scenarios , which also provides a complete code sample for using the content migration API.

Starting from this code sample, I walked through the API and got to a little application, which can be downloaded from the link below. Do note that as the application uses the SharePoint object model, it should run on the SharePoint 2007 server. Make sure to thoroughly test in test environment, as it is still work in progress...

When running the application, take a look at the session log on the right side of the screen. It lists the properties used in the deployment and may help you develop your own tailor made tools.

Tip: for incremental deployment you need 4 settings:

  1. ExportChangeToken field should contain the token from a previous export
  2. ExportMethod should be ExportChanges
  3. ExportObjectType should be either site or web
  4. Import RetainChangeIdentity should be selected

To make things easy, the little application (AKA CP) places the ExportChangeToken for you in the correct field upon an Export completion. You can also save the token, along with a descriptive statement, in an XML file, for future use.

[Update: Oct. 2, 2007] As CP takes its first steps, new ideas emerge. Two of them were already implemented:

  1. A batch version (for you, Sharon)
  2. An MSBuild task (to comply with your great development, Neeraj)

Both CPbatch and CPtask are also in the below downloadable ZIP.

To run them - use a settings XML file, which can be generated by "Save Preferences" in CP (the interactive version).

 

For other samples see Migrate a Web site from one location to another  and the WSS SDK.

Cool usage of STSADM for content migration can be found in Jackie's blog: SharePoint Content Migration Object Model and Content Migration Packages .

 

Disclaimer
This posting is provided "AS IS" with no warranties. Use of included utilities are subject to the terms specified here.

Enjoy content migration,

Ronalus

CP.zip