views:

40

answers:

1

I have an Outlook Addin which does some processing of the Outlook mailboxes. On processing an email it fires an MailProcessed Event, if it couldn't process the email it fires MailProcessFail Event.

Now I have an external service which is running. It calls the add-in every 60 seconds to start processing the emails. It needs to listen to the custom events fired from the Add In and then take action.

Now I have tried implementing this with a simple c# Event, but when it gets to the following code

this.OutLookPlugin.MailProcessed += this.MailProcessSuccess;

It throws the following Exception. ArgumentException: value does not fall within the expected range.

Has anyone managed to throw a custom event from within an Outlook addin and listen to it from an external service?

A: 

I do not think what you are trying to do is possible. You would need to call a method on a windows service (or something similar) that can handle the call.

Because the two programs are running on different threads they can't pick up each others events.

Burt
What so I would have to do an invoke?
Adam Price
In the end I decided not to try and pass events since it just didn't work. It also wouldn't allow complex information to be passed out of the Plugin.
Adam Price