SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to run the Word Automation Services immediately after adding a job. My code is running in a workflow.

Here is what I got so far :

    using (SPSite spSite = new SPSite(site))
        var job = new ConversionJob("Word Automation Services");
        job.UserToken = spSite.UserToken;
        job.Settings.UpdateFields = false;
        job.Settings.OutputFormat = SaveFormat.PDF;
        job.AddFile(source, destination);

        foreach (var service in spSite.WebApplication.Farm.Services)
            if (service.TypeName == "Word Automation Services")
                foreach (var jobDefinition in service.JobDefinitions)
                    if (jobDefinition.Name == "Word Automation Services")

But I got an access denied on the RunNow() method. Is there a way to call this method from a workflow ?

share|improve this question
up vote 2 down vote accepted

I used reflection to force the Automation Services to execute immediately. Works fine in our environment :-)

share|improve this answer

Try setting the schedule for the timer job to DateTime.Now, and update the job definition. Should execute it immediately that way.

share|improve this answer
Can you give a sample code for what you say ? I didn't found a way to translate what you said in code. – Baptiste Wicht Dec 26 '11 at 12:18


share|improve this answer
While this may theoretically answer the question, it is more helpful if you can provide a bit more information than just a fragment of code. Thanks. – SPDoctor Feb 8 '12 at 12:09
I tried your solution, but it didn't change anything. – Baptiste Wicht Feb 8 '12 at 18:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.