我正在使用代码运行一些内容部署作业,但作业不会逐步运行,而是通过导出所有对象来运行。是否可以使用下面的代码递增地运行它们?

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

有帮助吗?

解决方案

sharepoint 2007为您提供选项以使用选项来选择完整或增量作业的选项。在SharePoint 2010中,通过中央管理站点不再可用该选项。arrount的方式是使用powershell运行上面的命令。您可以设置以下PowerShell以配置要逐步运行的内容部署:

$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
.

在对象模型中,您可以使用调用CD作业

job.ExportMethod = SPExportMethodType.ExportChanges;
job.Run(true, job.LastSuccessfulDeploymentTime);   
.

许可以下: CC-BY-SA归因
scroll top