处理Outlook加载项中的附件事件

时间:2012-02-28 17:12:54

标签: c# outlook office-interop outlook-addin

是否有人知道我可以用来覆盖某人在Outlook加载项中打开电子邮件附件的技术?

基本上我被要求做的是,对于某些附件,改变行为,而不是打开附件,用户被重定向到网页。

我可以使用Application.AttachmentContextMenuDisplay挂钩附件上下文菜单但是如果用户只需双击电子邮件附件就不会触发。

使用的环境是VS2010,c#和outlook 2007/2010。

1 个答案:

答案 0 :(得分:3)

您应该查看ItemEvent BeforeAttachmentReadBeforeAttachmentPreview。请参阅this related post以供参考。

((Outlook.ItemEvents_10_Event)MailItem).BeforeAttachmentRead += new Outlook.ItemEvents_10_BeforeAttachmentReadEventHandler(ItemEvents_BeforeAttachmentRead);
((Outlook.ItemEvents_10_Event)MailItem).BeforeAttachmentPreview += new Outlook.ItemEvents_10_BeforeAttachmentPreviewEventHandler(ItemEvents_BeforeAttachmentPreview);