Ok, here's the situation. I am creating a system modeled closely to this:
I am at the point where I am adding the customization to an uploaded word document. But I'm getting an error, and I can't make sense of the error, so I can't proceed to fixing it. I hope someone here can help.
Here is the error I'm receiving (I've put this together in a catch, if you need the raw error, I can post that):
An error occurred while saving the form. at Microsoft.VisualStudio.Tools.Applications.Runtime.IAppInfoDocument.SetDocument(String fileName, Byte[] bytes, FileAccess access) at Microsoft.Office.Tools.OfficeAppInfoDocument.GetOfficeDocument() at Microsoft.Office.Tools.OfficeAppInfoDocument.EnsureDocument() at Microsoft.Office.Tools.OfficeAppInfoDocument.WriteItem(String element, String id, Byte[] item) at Microsoft.VisualStudio.Tools.Applications.Runtime.AppInfo.WriteManifest(IAppInfo appInfo, String manifest) at Microsoft.VisualStudio.Tools.Applications.Runtime.Customizer.CustomizeDocument() at Microsoft.VisualStudio.Tools.Applications.Runtime.Customizer.Customize() at Microsoft.VisualStudio.Tools.Applications.Runtime.ServerDocument.AddCustomization(String documentPath, String assemblyName, String deploymentManifestPath, String applicationVersion, Boolean makePathsRelative) at UploadLetter.AddCustomization(String savePath) in c:\Inetpub\wwwroot\MKDocumentPortal\UploadLetter.aspx.cs:line 125 Exception from HRESULT: 0x80040403 System.Collections.ListDictionaryInternal Void SetDocument(System.String, Byte[], System.IO.FileAccess)

Problem using ServerDocument.AddCustomization
gkat
I have same problem as Divermarv. When i try to use ServerDocument i get a COMException. It happens in a machine with VSTO SE Runtime but not in the developent machine with Visual studio 2005 and VSTO.
There is no documentation at all about this. Could anyone help us
Thanks.
Pablo.
DaverDee
Do you have Office installed on the machine where this is running If you are trying to add a VSTO customization to a previously uncustomized document then you need to have Office installed as VSTO needs to use Office to add the customization.
Thanks,
Ade
MCastellanos
I actually just finished a support ticket with Microsoft on this. Here is the result. I had deduced earlier that it was probably a permissions issue, and I was right. But what you have to do is go into the Component Services application and add in a bunch of rights for the Word application. You have to grant the iusr_xxx and iwam_xxx and aspnet accounts all kinds of rights. On the server! I didn't feel comfortable with that. Additionally the support tech said that the ServerDocument.AddCustomization() starts up an instance of Word on the server, and he was right. I also discovered that if an instance of word is already running, you get another exception. Well, if someone has uploaded a document, and this AddCustomization() process is running, then the next one will generate an exception. So we decided to not use the AddCustomization on the server. Instead, I created a Windows Application that adds, and modifies the customization and details appropriately.
But one more thing, the technician gave me a link to a MS KB article about the DSOFile. So we have decided when we get to the point where our clients will need to upload documents to which we can add the customization, we'll go that route. Here''s the link to the KB article.
http://support.microsoft.com/default.aspx/kb/224351
Good luck and hope this helps.
Marvin
tekagnos
I am getting the same error. I'm thinking that since I'm running this on the web server, under the asp.net account, then the process is not able to start word. Which is required when initializing a Server Document object. Is this true
Thanks