17.4. Using the Content Deployment API

In addition to the administration interface available from Central Administration Operations, content deployment is exposed as an API via the Microsoft.SharePoint.Publishing.Administration namespace. This API is useful when administrators wish to provide an alternative user interface for managing content deployment paths and jobs.

The following simple example in Listing 17-1 shows how to enable content deployment in the source farm, create a path and job, and execute the job from a console application. The status of the job is output as the code executes. Once the operations are complete, the job and path are deleted.

Example 17-1. Leveraging the content deployment API
using System; using System.Collections.Generic; using System.Text; using Microsoft.SharePoint.Publishing.Administration; namespace WROX.ProMossWcm.Chapter17 { class Program { static void Main(string[] args) { ContentDeploymentSample sample = new ContentDeploymentSample(); sample.Invoke(); } } class ContentDeploymentSample { public void Invoke() { // Path Settings string pathName = "Content deployment Sample 1"; Uri sourceServerUri = new Uri("http://cdsource"); string sourceSiteCollection = "/"; Uri destinationAdminUri = new Uri("http://moss2007:8888"); Uri destinationServerUri = new Uri("http://cddestination"); string destinationSiteCollection = "/"; // job Settings string jobName ...

Get Professional SharePoint® 2007 Web Content Management Development: Building Publishing Sites with Office SharePoint Server 2007 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.