views:

484

answers:

2

Hi All, based on http://stackoverflow.com/questions/630449/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

A: 

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

John Saunders
A: 

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.

Michael Stum
Unfortunately they aren't all Office 2007 documents, most of them are 2003. Thanks for the Document Converter link, I'll be sure to read it through.
niklassaers-vc
Would Migration Planning Manager (http://tinyurl.com/tdt6r) be a good way to convert the documents to Word 2007 and then go the Office Open XML SDK route?
niklassaers-vc
I have no experience with Migration of existing documents to 2007 since I always only needed to open and re-save them in Office 2007, but if your users are not Office 2007 yet that that would not be an option anyway. I don't know if you can batch-convert documents to 2007 with any tool :/
Michael Stum