Outlook 2010 AddIn:是否有在将项目添加到文件夹*之前*触发的事件?

发布于 2024-12-28 21:46:14 字数 588 浏览 0 评论 0原文

我正在编写一个 Outlook 插件,它应该提供一个新的特殊文件夹,用户可以将邮件项目拖入其中,以便由插件处理它们。

现在,每当用户尝试执行此操作时,我都希望收到通知;但它发生之前。然而,似乎没有办法做到这一点。

使用文件夹的 BeforeItemMove 事件,当用户尝试将项目移出文件夹时,Outlook 会通知我 - 但没有什么比 BeforeItemAdd 更好的了事件。

接近的一件事是文件夹项目集合的 ItemAdd 事件,但该事件在添加项目后触发;那时,手术已经完成。我看不出有什么方法可以判断该项目最初来自哪里,或者(与 BeforeItemMove 事件不同)在 AddIn 确定该项目由于某种原因无效时取消该操作。

理论上,我应该能够向所有其他文件夹添加一个 BeforeItemMove 处理程序,并在移动目标是由我的 AddIn 管理的文件夹时对它们做出反应,但这看起来像有点过分了……有没有更简单的方法?

I'm writing an Outlook AddIn which is supposed to offer a new special folder which the user can drag mail items into, in order to have them processed by the AddIn.

Now I'd like to be informed whenever the user tries to do that; but before it happens. However, there does not seem to be a way to do that.

Using the folder's BeforeItemMove event, Outlook informs me when the user tries to move an item out of the folder - but there is nothing like a BeforeItemAdd event.

The one thing that comes close is the ItemAdd event of the folder's items collection, but that one fires after an item has been added; at that time, the operation has already been completed. I see no way to tell where the item originally came from or (unlike the BeforeItemMove event) to cancel the operation in case the AddIn determines that it is not valid for some reason.

Theoretically, I should be able to add a BeforeItemMove handler to all the other folders and react to them whenever the move target is the folder managed by my AddIn, but that seems like a bit of overkill... isn't there an easier way?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

等你爱我 2025-01-04 21:46:14

不能这样做,所有 MAPI 事件都是异步的,并且发生某些事情后触发。
Outlook 确实会同步触发一些 UI 事件(如 BeforeItemMove),但没有像 BeforeItemAdd 那样的事件。

Can't do that, all MAPI events are asynchronous and fire after something happens.
Outlook does fire some UI evenst synchronously (like BeforeItemMove), but there is nothing like BeforeItemAdd.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文