如何以编程方式执行 Word Automation Services?

发布于 2024-11-04 06:45:53 字数 600 浏览 3 评论 0原文

如何以编程方式强制执行/启动 Word Automation Services?
我需要在提交转换过程后启动/执行。

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

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

漆黑的白昼 2024-11-11 06:45:53

是的,您可以强制作业从代码以及中央管理 UI 立即启动。请参阅我的解决方案(构建在 SPJobDefinition 类的 RunNow 方法之上)在这里

您应该启动Word Automation Services 计时器作业

例如,使用 PowerShell:

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

或者更短:

Start-SPTimerJob "Word Automation Services"

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"
浪推晚风 2024-11-11 06:45:53

您是否询问是否有办法强制立即执行作业,而不是等待 Word Automations Services 管理设置中设置的时间间隔?
目前,在 SP 2010 的 Word Automation Services 中,无法执行此操作。我能想到的就是将时间间隔更改为最小值 1 分钟(而不是默认的 15 分钟)。

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文