如何以编程方式执行 Word Automation Services?
如何以编程方式强制执行/启动 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,您可以强制作业从代码以及中央管理 UI 立即启动。请参阅我的解决方案(构建在 SPJobDefinition 类的 RunNow 方法之上)在这里。
您应该启动Word Automation Services 计时器作业。
例如,使用 PowerShell:
或者更短:
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:
or even shorter:
您是否询问是否有办法强制立即执行作业,而不是等待 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).