Make ItemSend trigger after all other add-ins even though ProgId has a "large" value so that it would trigger first in normal cases

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

Make ItemSend trigger after all other add-ins even though ProgId has a "large" value so that it would trigger first in normal cases
 
EnterpriseDev


Guest


Hi,

I have an add-in that has a ProgId of value "zz.MyAddIn" to make the ItemSend function be called BEFORE all other add-ins. This works great. The ItemSend callback is registered in the AddinStartupComplete. This has worked great in all scenarios that I have seen.

Now to the special case, I need to have a configuration variable that cases my ItemSend to be called LAST instead (AFTER all other add-ins). Is there any other event of Add-in Express that I can use for this where I can register my ItemSend callback so that it is called before other add-ins? I cannot change the progId to a low value (e.g. "aaa.MyAddIn") as this is not practical and would require a custom MSI file.

I hope the question make sense.
Posted 29 Mar, 2018 11:59:03 Top
Andrei Smolin


Add-in Express team


Posts: 18830
Joined: 2006-05-11
Hello,

You can create one more add-in. Two add-ins can communicate via the following code path:

OutlookApp.COMAddins.Item(strMyComAddinProgId).Object.MyPublicPropertyOrMethod.

1. strMyComAddinProgId - see the ProgId attribute of your add-in module.
2. MyPublicPropertyOrMethod is called via late binding (see System.Type.InvokeMember in MSDN or search through our forums)

See also http://www.add-in-express.com/creating-addins-blog/2010/07/02/standalone-application-addin-communicate/.


Andrei Smolin
Add-in Express Team Leader
Posted 30 Mar, 2018 03:51:41 Top
EnterpriseDev


Guest


That is creative but a little too complicated as well. Was thinking if there was another "earlier" event than AddinStartupComplete where the ItemSend could be registered.
Posted 30 Mar, 2018 05:32:01 Top
Andrei Smolin


Add-in Express team


Posts: 18830
Joined: 2006-05-11
I suppose, this won't help. The add-in can register to an event when it is being loaded; connecting to an event during this process shouldn't make any difference. Try to override the OnHostApplicationInitialized method of the add-in module; this is the very first moment when the add-in may do something.


Andrei Smolin
Add-in Express Team Leader
Posted 30 Mar, 2018 05:57:34 Top
EnterpriseDev


Guest


Thank you.

I tried registering the event callback in OnHostApplicationInitialized, but ItemSend was still called before other add-ins due to the "zz.MyAddin" progId. I guess that was as epxected.

I also tried changing the progId to "aa.MyAddin" and it worked fine and my ItemSend got called AFTER the other add-in. Trouble is I really prefer to not to this.

I happen to know the progId of the other add-in I am trying to get "AFTER" and I also know that the other add-in is indeed a ADX add-in. Is there any way do you think I can "trick" ADX to somehow call my ItemSend AFTER the other add-in's ItemSend? Maybe I can use OutlookApp.COMAddins.Item(otherAddinProgId).DoSomethingHacky() to change the order of ItemSend somehow? Or rearrange the order in the OutlookApp.COMAddins.Item list somehow?
Posted 30 Mar, 2018 07:18:49 Top
Andrei Smolin


Add-in Express team


Posts: 18830
Joined: 2006-05-11
EnterpriseDev writes:
Is there any way do you think I can "trick" ADX to somehow call my ItemSend AFTER the other add-in's ItemSend?


This order is defined by the host application; you can't override this behavior. The only way to achieve your goal is to use another (second) add-in.


Andrei Smolin
Add-in Express Team Leader
Posted 30 Mar, 2018 07:35:58 Top
EnterpriseDev


Guest


Thanks Andrei! In that case I will choose the method of changing the progId instead even though it kind of hurts.
Posted 30 Mar, 2018 07:37:19 Top