how to use microsoft.office.interop.outlook.dll in Add In setup?

Add-in Express™ Support Service
That's what is more important than anything else

how to use microsoft.office.interop.outlook.dll in Add In setup?
 
Paul Skliarenko




Posts: 2
Joined: 2016-05-11
Hello

I had a problem with microsoft.office.interop.outlook.dll. Under certain scenarios my client got an exception EXCEPTION MESSAGE: Exception from HRESULT: 0x8004010F STACK TRACE:
at Microsoft.Office.Interop.Outlook._AppointmentItem.get_Application().

I saw in the folder with installed Add in - "microsoft.office.interop.outlook.dll" is missing in the install folder.
When I took last version of Dll and put it to install folder - problem was fixed.
(There was another major version in GAC)

Should I include last version of "microsoft.office.interop.outlook.dll" to my add in setup? And as I read here

https://www.add-in-express.com/creating-addins-blog/2010/03/16/interop-assemblies-late-binding/ - should I check ADXAddinModule.HostVersion and disable the UI?

Thanks
Posted 11 May, 2016 13:59:27 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Paul,

Should I include last version of "microsoft.office.interop.outlook.dll" to my add in setup?


In your setup project, you need to include all Primary Interop Assemblies that are located in the Interop sub-folder of your project's folder.

There is another way if your add-in targets .NET Framework 4 or higher - you can set the "Embed Interop Types" property to True for the Microsoft.Office.Interop.Outlook.dll, Microsoft.Vbe.Interop.dll and Office.dll references. In this case, these assemblies are not required to be installed on the target machine.

should I check ADXAddinModule.HostVersion and disable the UI?


Of course, you can do this. But I would suggest using the minOfficeVersionsupported attribute of the adxloader.dll.manifest. Please have a look at the
https://www.add-in-express.com/docs/net-deploying-addins.php#loader-manifest chapter.
Posted 12 May, 2016 04:25:12 Top
OliverM


Guest


Hi Dmitry,

Is there a build-in functionality to get the minOfficeVersionsupported attribute at runtime?
Posted 12 May, 2016 05:01:14 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Oliver,

There is no such functionality. But you can read the adxloader.dll.manifest file contents by using the native System.Xml.XmlDocument class. May I ask why you need to know the value of the minOfficeVersionSupported attribute at run-time?
Posted 12 May, 2016 05:18:52 Top
OliverM


Guest


Hi Dmitry,

My question is related to the NOTA BENE section in article https://www.add-in-express.com/creating-addins-blog/2010/03/16/interop-assemblies-late-binding/ which describes possible issues when deploying multiple interops.

In such a scenario comparing the minOfficeVersionSupported attribute against the HostVersion would avoid working with hard coded string values.
Posted 12 May, 2016 05:38:30 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Oliver,

I am not sure I understand you correctly. The minOfficeVersionSupported attribute is checked by the Add-in Express loader on an Office application start. If the Office application version is lower than the minOfficeVersionSupported value, the loader stops loading/creating managed code. So, neither your add-in module is created nor any event of your code is fired.
Posted 12 May, 2016 05:59:13 Top
OliverM


Guest


This is what I thought in the first place as well but the NOTA BENE section says

A variation of this scenario occurs when your add-in supporting, say, Outlook 2007 and higher is loaded by Outlook 2000, 2002, or 2003. Indeed, if all files are supplied with your setup project (setup projects generated by Add-in Express include interop assemblies by default), then your add-in will be loaded by an unwanted Office application version


That is what is confusing me.
Posted 12 May, 2016 06:09:27 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Oliver,

That article was written in the year of 2010. The minOfficeVersionSupported attribute was introduced in the latest version 8 of Add-in Express. You can use either this attribute or your own code for checking versions of Office applications.
Posted 12 May, 2016 10:06:44 Top
OliverM


Guest


Hi Dmitry,

Thank you very much for the clarification!
Posted 12 May, 2016 10:20:25 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
You are welcome!
Posted 12 May, 2016 10:40:53 Top