从 SharePoint 工作流运行 Word

发布于 2024-07-15 03:15:22 字数 849 浏览 2 评论 0原文

基于加入MS Word文档我制作了一个控制台应用程序,将多个word文件拼接成一个。 现在我想从 SharePoint 中的工作流执行相同的操作。 简而言之,我的代码在失败之前如下所示:

object oMissing = System.Reflection.Missing.Value;
Microsoft.Office.Interop.Word.ApplicationClass oWord = new Microsoft.Office.Interop.Word.ApplicationClass();
Microsoft.Office.Interop.Word._Document oDoc = null;
oWord.Visible = false;
Microsoft.Office.Interop.Word.Documents oDocs = oWord.Documents;
object oFile = tmpFileName;
oDoc = oDocs.Add(ref oMissing, ref oMissing, ref oMissing, ref oMissing);
oDoc.Activate();

当我到达 oDoc.Activate() 时,我会抛出以下异常,即使我只有一个工作流程实例正在运行,并且没有其他 Word 实例在运行服务器:

消息过滤器表明应用程序正忙。 (HRESULT 异常:0x8001010A (RPC_E_SERVERCALL_RETRYLATER))

为什么我会收到此错误? 什么会使应用程序变得繁忙?

干杯

尼克

based on Join MS Word documents I have made a console application that splices multiple word files into one. Now I want to do the same from a Workflow in SharePoint. In short, my code before it fails looks like this:

object oMissing = System.Reflection.Missing.Value;
Microsoft.Office.Interop.Word.ApplicationClass oWord = new Microsoft.Office.Interop.Word.ApplicationClass();
Microsoft.Office.Interop.Word._Document oDoc = null;
oWord.Visible = false;
Microsoft.Office.Interop.Word.Documents oDocs = oWord.Documents;
object oFile = tmpFileName;
oDoc = oDocs.Add(ref oMissing, ref oMissing, ref oMissing, ref oMissing);
oDoc.Activate();

When I reach oDoc.Activate(), I'm thrown the following exception, even though I only have one instance of the workflow running and no other instances of Word is running on the server:

The message filter indicated that the application is busy. (Exception from HRESULT: 0x8001010A (RPC_E_SERVERCALL_RETRYLATER))

Why do I get this error?? What would make the application busy?

Cheers

Nik

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

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

发布评论

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

评论(2

看透却不说透 2024-07-22 03:15:22

如果它们是 Word 2007 文档,我认为您应该查看 Word 文件格式并查看 Microsoft 的文章是否有帮助:

,在服务器上运行是最后一件事我会推荐,除非确实没有其他方法可以做到。

在 Sharepoint 环境中,也许 文档转换器 可以以某种方式提供帮助,尽管我对它们没有任何经验——只是作为一个提示来看看。

If they are Word 2007 Documents, I think that you should look into the Word File Formats and see if the Article from Microsoft helps:

http://msdn.microsoft.com/en-us/library/bb656295.aspx

Office Interop is always a bit unstable, and running it on a server is the last thing I would recommend unless there is really no other way to do it.

In a Sharepoint Environment, maybe the Document Converters can somehow help, although I have no experience with them - just as a hint at something to look at.

久夏青 2024-07-22 03:15:22

Office 应用程序不是为在服务器环境中运行而构建的 - 它们纯粹是桌面应用程序。 不要从服务器呼叫他们。

The Office applications are not built to run in a server environment - they are purely desktop applications. Don't call them from a server.

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