Running Word from a SharePoint Workflow

0

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

.net
sharepoint
interop
workflow
ms-word
asked on Stack Overflow Mar 12, 2009 by niklassaers-vc • edited May 23, 2017 by Community

2 Answers

0

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

answered on Stack Overflow Mar 12, 2009 by John Saunders
0

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.

answered on Stack Overflow Mar 12, 2009 by Michael Stum

User contributions licensed under CC BY-SA 3.0