Error creating documents (Excel/Word) in my Office Addin when Autodesk Vault Office Addin is loaded and connected to Vault

Error creating documents (Excel/Word) in my Office Addin when Autodesk Vault Office Addin is loaded and connected to Vault

mobworld
Enthusiast Enthusiast
1,017 Views
3 Replies
Message 1 of 4

Error creating documents (Excel/Word) in my Office Addin when Autodesk Vault Office Addin is loaded and connected to Vault

mobworld
Enthusiast
Enthusiast

Hello there,

 

I'm currently working on an Office Addin (VSTO technology) and have a problem.

 

Office is 32 bit

Vault version is 2020.

 

The problem is only present when the user is logged in to Vault using Autodesk's Vault addin for Office (Word and Excel). When user isn't logged in, everything works as expected.

 

Regarding Excel, I get and error when trying to add a new Excel workbook to Excel's WorkBooks Collection and in Word the problem occurs when I try to save a newly created document to disk using document.SaveAs/document.SaveAs2 method

 

Code in Excel Addin :

 private void button1_Click(object sender, EventArgs e)
        {

            try
            {
                //AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;

                //string currPath = System.Environment.GetEnvironmentVariable("PATH");
                //currPath = @"C:\Program Files (x86)\Autodesk\DM Apps\Office Addin 2020\;" + currPath;
                //System.Environment.SetEnvironmentVariable("PATH", currPath);

                Microsoft.Office.Interop.Excel.Workbook newDoc = null;
                newDoc = ExcelAddIn1.Globals.ThisAddIn.Application.Workbooks.Add();

                newDoc.SaveAs(@"c:\temp\temp.xlsx");
            }
            catch (Exception ex) { }
            finally
            {
                //AppDomain.CurrentDomain.AssemblyResolve -= CurrentDomain_AssemblyResolve;
            }
        }
        private System.Reflection.Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
        {
            string[] asmName;
            string asmPath;
            asmName = args.Name.Split(",".ToCharArray());

            if (Environment.Is64BitProcess) { asmPath = @"D:\SourceCode\_AzureDevOps\NTI.Tools.Acw\_Build\AddCardWizard" + @"\Vault 2020 (x64)\x64\" + asmName[0] + ".dll"; }
            else { asmPath = @"C:\Program Files (x86)\Autodesk\DM Apps\Office Addin 2020\" + asmName[0] + ".dll"; }
            if (System.IO.File.Exists(asmPath))
            {
                System.Reflection.Assembly assembly = System.Reflection.Assembly.LoadFile(asmPath);
                return assembly;
            }
            return null;
        }

 

When I run the code above, I get the following error:

 

ExcelAddin1.PNG

("Could not load file or assembly 'Connectivity.Common.Windows, Version=1.0.6996.38200, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.")

 

As the code shows, I have tried different things to make this work :

1. tried adding the path where the Vault Office Vault files are located to environment variable PATH

2. tried using assembly resolve to point to the location of the Vault Office files.

 

Modifing environment PATH, does not make any difference. When adding a AssemblyResolve handler, the event gets fires and I returns the assemblies found in 'C:\Program Files (x86)\Autodesk\DM Apps\Office Addin 2020' (Vault Office addin folder installed by Vault Client). When using AssemblyResolve, I get the following nasty error :

ExcelAddin2.PNG

and Excel crashes.

 

NOTE : All of this above only happens when Vault Addin is loaded and users is connected to Vault. I found a post from 2013 https://forums.autodesk.com/t5/vault-customization/filenotfoundexception-in-office-s-saveas-methods/... with the same problem (my Word problem is as described in the post)

 

 I'm able to reproduce the problem consistently using a very simple example as shown above. I'm very sure this must be something in "C:\Program Files (x86)\Autodesk\DM Apps\Office Addin 2020\VaultClient.dll" (Vault Office addin) which is causing the problem.

 

I'm aware that Vault 2020 sdk is only present in 64bit, but the problem shown in the example, does not use any Vault assemblies/references. But problem still occurs

 

Someone who can point me in the right direction ?

 

Thank you

 

0 Likes
1,018 Views
3 Replies
Replies (3)
Message 2 of 4

mobworld
Enthusiast
Enthusiast

I've just updated to Vault 2020.3 and the problem still exists.

 

Got this error message, which clearly shows that the error lies within Vault Office plugin (OfficeAddinCommon.dll)
(I'm not referencing any Vault assemblies in my little test solution)

ExcelAddin3.PNG

 

Any suggestions are very appreciated 😉

 

How do I make Autodesk aware of this problem ? Old-school ADN bug reports does seem to exist any more ?

 

Thank you

0 Likes
Message 3 of 4

jose_oltra
Advocate
Advocate

Hello @mobworld !

Did you finally managed to solve this issue?

I'm facing the same problem with excel, exactly at the same point (when the user is logged into Vault, if he is not logged in , no issue at all).

Can you share any workaround or anything you discovered?

Thank you!

Inventor
Revit
Vault Professional
Autocad
0 Likes
Message 4 of 4

mobworld
Enthusiast
Enthusiast

Hello,

Sorry to inform you that I've no solution to this problem.

 

In sept 2020, I opened a support case with Autodesk using my Autodesk Partner account (Autodesk Partner center caseno 16889611 ), but besides confirming that they can reproduce the problem,  nothing has been happening !.

 

The only work around, is to code all the functions from the Office-plugin (checkin/out/undo etc) yourself... A big job, considering it may be obsolete if Autodesk fix the bug/make connection avaliable to Office

 

Kind regards.

 

 

0 Likes