Helliotine
Helliotine

Reputation: 1

VSTO Add-In : How to make one add-in from 3 add-ins for 3 Outlook versions?

I have three addins that do roughly the same thing, but one is for Outlook 2010, one for 2013 and one for 2016. I've been researching for a couple days how to (and if it is at all possible to) make it so I have only one that would install on the three versions of Outlook.

I know that the add-in for Outlook 2016 uses a few objects (and maybe events) that don't exist in Outlook 2010, but I'm pretty sure that's not that bad, that I could just verify the version when the start-up event fires and go from there ?

I'm very new at VSTO Add-Ins, so I haven't yet tried anything, but from what I read, all of them should be able to work on any version, provided a few tweaks? Problem is: I'm not even sure of that because I've seen a lot of different views on this (people saying it's possible and others saying "hum no, just don't") and even if I was I think what I understood is there might be problems of compatibility because of the PIAs ?

I just have no idea where to go from here, actually.

Upvotes: 0

Views: 82

Answers (1)

Eugene Astafiev
Eugene Astafiev

Reputation: 49455

VSTO allows creating add-ins that support multiple Office versions. Read more about that in the Run solutions in different versions of Microsoft Office article.

Note, you need to use PIAs that correspond to the lowest version of Office supported. In that case, you can make sure no runtime exception is fired by a member which doesn't exist in a new Office version. At runtime, you may check the host application version and use the late-binding technology represented by Reflection in the .net development world, see Type.InvokeMember for more information.

Also, you may consider using Add-in Express. They allow creating version-neutral add-ins out of the box.

Upvotes: 1

Related Questions