Is there a way to detect if a content deployment is ready?
-
07-12-2019 - |
题
I need to detect if a content deployment between two different sharepoint 2010 farms is finished. Is there a way to achieve this programmatically? I've been looking around for some days now but without success.
Are there any Event-Handlers or CustomActions I can use? At the moment I'm building my own deployment job using SPImport
and SPExport
but that seems many overhead for me. All I need to do is to execute a simple function when the content deployment is finished.
Thank you very much! LMW
P.S. I'm using Sharepoint2010 and VS2010/C#
解决方案
You have to check the ContentDeploymentJobStatus until it returns "Success". You can use code like below.
ContentDeploymentJobCollection cdJobCollection = ContentDeploymentJob.GetAllJobs();
foreach (ContentDeploymentJob job in definitionCollection)
{
if (job.Name.StartsWith(strYourJobName.ToLower()) && job.LastStatus==ContentDeploymentJobStatus.Success)
return true;
}
其他提示
What you can do is to send the success / error email to an email enabled SharePoint list. In that list you'll have a receiver on item added that can execute some code on the site collection / web app / farm ... depending on the elevation / work to be executed.
You could also do a little bit of screenscrapping on the central administration dashboards but that it's even clumsier than the first suggested solution.
Kindly