在Outlook加载项中处理附件事件
问题描述:
是否有人知道我可以用来覆盖某人在Outlook加载项中打开电子邮件附件的技术?在Outlook加载项中处理附件事件
本质上,我被要求做的是为了某些附件,改变行为,以便打开附件而不是将用户重定向到网页。
我可以用Application.AttachmentContextMenuDisplay
挂钩到附件上下文菜单中,但是如果用户只需双击电子邮件附件就不会触发该附件。
使用的环境是VS2010,c#和outlook 2007/2010。
答
你应该看看ItemEvent
BeforeAttachmentRead
和BeforeAttachmentPreview
。请参阅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);
SilverNinja, 这几乎就是我所需要的。然而,在Outlook中双击时,有许多类型的附件会出现打开/保存/取消对话框。如果打开处理程序然后单击“打开”,则会触发打开的处理程序,但如果它们单击“保存”,则会在BeforeAttachmentWriteToTempFile事件触发之前提示输入文件名,并且在处理程序中设置“cancel = true”会导致Outlook弹出对话框“Outlook can not保存文件“。 理想情况下,我想获得一个处理程序,当他们双击附件时,在“打开/保存/取消”对话框之前,以避免这种混淆行为。 – eoldre 2012-02-28 19:16:41