Outlook 2007 加载项中的触发事件由外部应用程序拾取
我有一个 Outlook 插件,它对 Outlook 邮箱进行一些处理。处理电子邮件时,它会触发 MailProcessed 事件,如果无法处理电子邮件,则会触发 MailProcessFail 事件。
现在我有一个正在运行的外部服务。它每 60 秒调用一次加载项以开始处理电子邮件。它需要侦听从加载项触发的自定义事件,然后采取行动。
现在我尝试使用简单的 c# Event 来实现此目的,但是当它到达以下代码时,
this.OutLookPlugin.MailProcessed += this.MailProcessSuccess;
它会抛出以下异常。 ArgumentException:值不在预期范围内。
有没有人设法从 Outlook 插件中抛出自定义事件并从外部服务监听它?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为你想做的事情是不可能的。您需要调用 Windows 服务(或类似的服务)上可以处理该调用的方法。
因为这两个程序在不同的线程上运行,所以它们无法获取彼此的事件。
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.