Calling an Add-in method from another Application

  • Thread starter Thread starter David
  • Start date Start date
D

David

I have used VSTO SE to create an Outlook 2003 add-in in C#.

I would like to be able to invoke a method of the add-in from a separate
application.
(Similar to pollyanna65 post "Programmatically sending email via Outlook COM
Add-In" below).


I have created the add-in with a public method.
The add-in is installed an functioning correctly.


From another application I get an Outlook.Application class object and
iterate through the COMAddIns collection to find the addin I have created.

What can I do to this COMAddIn object to allow me to call my method? How can
I cast it to something I can use?
 
Look for a thread titled "Outlook 2007 COM add-in callback" in the
microsoft.public.office.developer.com.add-ins group, or google for that
thread.

I posted a C# example of working with a public method in an addin for VSTO
2005 SE. Make sure to read the entire thread, I made a typo in my original
sample code.
 
Thanks Ken.
It's taken I while to work through the post and build an example, I've got a working prototype now.

It was the RequestComAddInAutomationService call that nailed it.
 
Yes, that's the new twist they threw in to keep us MVPs busy <g>




Thanks Ken.
It's taken I while to work through the post and build an example, I've got
a working prototype now.

It was the RequestComAddInAutomationService call that nailed it.
 
Hi - this is all going well, but..

My application that attempts to use the externally available call can't seem to get hold of the add-in.
I get the following exception:
System.Runtime.InteropServices.COMException (0x80010001): Call was rejected by callee. (Exception from HRESULT: 0x80010001 (RPC_E_CALL_REJECTED))

The calls I am making are:
Outlook.ApplicationClass olApp = new Outlook.ApplicationClass();
Outlook.NameSpace olNS = olApp.GetNamespace("MAPI");
MSOffice.COMAddIns addIns = olApp.COMAddIns;

I do not get he error if Outlook is running before my application starts.

I suspect this is something to do with me trying to access the AddIn before it is loaded - does that sound plausable?

Any thoughts on what I should do?

Thanks
 
Back
Top