【问题标题】:Handling attachment events in an outlook add-in在 Outlook 加载项中处理附件事件
【发布时间】:2018-10-01 17:43:25
【问题描述】:

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

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

我可以使用Application.AttachmentContextMenuDisplay 连接到附件上下文菜单,但是如果用户只是双击电子邮件附件,则不会触发该菜单。

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

【问题讨论】:

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


    【解决方案1】:

    你应该看看ItemEventBeforeAttachmentReadBeforeAttachmentPreview。参考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 不能保存文件”。理想情况下,我希望在“打开/保存/取消”对话框之前双击附件时获得一个处理程序,以避免这种令人困惑的行为。
    猜你喜欢
    • 2021-10-24
    • 2013-06-24
    • 2016-09-08
    • 2021-10-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-07-11
    相关资源
    最近更新 更多