Question

I am running some Content Deployment jobs using the code but the jobs are not run incrementally, instead they are run by exporting all the objects. Is it possible to run them incrementally using the code below?

 ContentDeploymentJobCollection collection = ContentDeploymentJob.GetAllJobs();    
 foreach (ContentDeploymentJob job in collection)
 {    
       job.Run(true); //run the job asynchronously                                   
 }
Was it helpful?

Solution

SharePoint 2007 give you option to run content deployment with the option to select full or incremental job. In SharePoint 2010, that option is no longer available via the central administration site. The way arround it is to run the above command with powershell. You can set the following PowerShell to configure the Content Deployment to be run incrementally:

$PathName                   = "Test Path"
$JobName                    = "My Job"
$IncrementalEnabled         = $true


Write-Host -ForegroundColor White "- Creating content deployment job"
$CTJob = New-SPContentDeploymentJob -Name $JobName -SPContentDeploymentPath $PathName -IncrementalEnabled:$IncrementalEnabled -ScheduleEnabled:$false

In the object model you can call your CD job using

job.ExportMethod = SPExportMethodType.ExportChanges;
job.Run(true, job.LastSuccessfulDeploymentTime);   
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top