How to force execute/start of Word Automation Services programmatically?
I need to start/execute once submit a conversion process.

    string siteUrl = "http://localhost";
    string wordAutomationServiceName = "Word Automation Services";
    using (SPSite spSite = new SPSite(siteUrl))
    {
        ConversionJob job = new ConversionJob(wordAutomationServiceName);
        job.UserToken = spSite.UserToken;
        job.Settings.UpdateFields = true;
        job.Settings.OutputFormat = SaveFormat.PDF;
        job.AddFile(siteUrl + "/Shared%20Documents/Test.docx", siteUrl + "/Shared%20Documents/Test.pdf");
        job.Start();
    }
有帮助吗?

解决方案

Are you asking if there is a way to force the job to execute immediately, rather than waiting for the time interval set in the Word Automations Services admin settings? Currently, in Word Automation Services for SP 2010, there is no way to do this. All I can think of is to change the time interval to the minimum of 1 minute (as opposed to the default of 15 minutes).

其他提示

Yes, you can force the jobs to start immediately from code as well as from the Central Admin UI. See my solution (built on top of the RunNow method of the SPJobDefinition class) here.

You should start the Word Automation Services Timer Job.

For eaxmple, using PowerShell:

$watj = Get-SPTimerJob "Word Automation Service Application"
$watj.RunNow()

or even shorter:

Start-SPTimerJob "Word Automation Services"
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top