Content Migration using SAF

SAF contains 6 ready-to-use Actions that allow the Exporting and Importing of :

– List Items

– Lists

– Webs

The 3 pairs of Actions that allow you to do this, are namely :

– ExportListItem & ImportListItem

– ExportList & ImportList

– ExportWeb & ImportWeb

The actions are listed as pairs for convenience, although there is nothing that mandates that they have to be run one after the other. In fact, you can export a List and import it into a completely different Farm months later if you so wish. In addition to this, although each pairing exports and imports different types of content, they all follow the same process, which is :

1. Export to a Content Migration Package (CMP) according to settings specificied in the “Export” Action.

2. Import from a CMP file according to settings specificed in the “Import” Action.

In principal that’s it! If you download the source code from here : http://SAF.Codeplex.com, you will find some useful examples at the locations listed below :

  1. {YourDrive}\src\CollaborisSaf.SampleFeatures\12\TEMPLATE\FEATURES\WSS.ContentMigration.CopyListItem
  2. {YourDrive}\src\CollaborisSaf.SampleFeatures\12\TEMPLATE\FEATURES\WSS.ContentMigration.CopyList
  3. {YourDrive}\src\CollaborisSaf.SampleFeatures\12\TEMPLATE\FEATURES\WSS.ContentMigration.CopyWeb

The examples all demonstrate how to export and import in one go from a Feature. However, in reality, you will more than likely Export from a publishing Farm (using the STSAdm Adapter for SAF) and then do the Import from a Feature. This means that your CMP can then be easily checked into TFS and then triggered as part of a daily build.

Example : A Macro illustrating how to Export List Item(s) from a chosen List.

The example below contains a SAF Macro that Exports a List Item (with an ID of ‘1’) from a list called ‘SportsList’ in a Web called ‘http://localhost/sports’. This will then create a CMP package called ‘Exported.cmp’. This CMP can then later be imported into a new web (in a new farm), using Import List Item (see next example).

Example : A Macro illustrating how to Import List Items (s) into a destination List.

The example below contains a SAF macro that Imports a set of List Items from a CMP Package called ‘Exported.cmp’ into a list called ‘SportsList’ (contained in a Web called ‘http://IntegrationWeb/DestWeb1’).

A couple of Important Points :

  1. The source and destination lists must be schematically identical.
  2. The account which the Macro runs under, must have relevant permissions to both the source and destination list. (Although this can be 2 different users).
  3. All 3 pairs of Actions require SharePoint SP1 as a minimum.
  4. Please feel free to ask any questions here, so that I can help to structure the documentation around your needs.