Search code examples
c#asp.netsharepointsharepoint-2010word-automation

How to execute Word Automation Services programmatically?


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();
    }

Solution

  • 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).