Office 2010 Outlook 插件不只保存附件
我继承了 Outlook 的 Office 2010 插件。它应该能够将邮件、附件或两者保存在单独的数据库/文件中。它可以很好地保存包含附件的邮件(也称为两者)。如果我选择仅保存附件,它仍然会保存两者(邮件+附件),即 - 一个包含附件的不错的消息文件(消息是 Outlook 邮件文件格式)。 还有一个 Office 2003/2007 版本可以正确执行此操作,保存邮件、附件或两者都待选择。我已经检查了代码几天了,但我还没有找到 2003/7 能够做什么和 2010 不能做什么之间的区别。
难道从代码的角度来看,Outlook 2010不能将邮件和附件分开保存吗?
详情:
Office 2003 插件:用 C#、.NET3.5、VS8 编写
Office 2007 插件:C#、.NET3.5、VS8
Office 2010 插件:C#、.NET4、VS10
我们已正式停用 2003 版本,并且不再维护该版本。 2007 年正在修复有人报告任何问题的错误。 2010 年是“新”黑色;)
我可能找到了一个关键点
protected override void EnableAddAttachmentsToLegis()
{
// Adds a button on the right click context menu,
// when user clicks on an attachment:
_application.AttachmentContextMenuDisplay
+= new Outlook.ApplicationEvents_11_AttachmentContextMenuDisplayEventHandler
(Application_AttachmentContextMenuDisplay);
}
http://technet .microsoft.com/en-us/query/bb623145 - 真糟糕,现在的好问题是 - 什么取代了它,或者它被完全废除了。
已被 2007 年取代 - http:// msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook.applicationevents_11_event_members.aspx - 已弃用2010年。
I have inherited an office 2010 plugin for Outlook. It is supposed to be able to save the mails, attachments or both in a seperate database/file. It saves the mails incl attachments just nicely (aka both). If I choose only to save the attachments it still saves both (mail + attachments), that being - a nice msg file with attachments included (msg being outlook mail file format).
There is also an Office 2003/2007 version that can do this correctly, either saving the mail, the attachments or both pending on choice. I have been reviewing the code for a couple of days now and I haven't been able to find the difference between what the 2003/7 is capable of and what 2010 is not capable of.
Can it be that the Outlook 2010 can't save mails and attachments seperately from a code perspective?
Details:
Office 2003 plugin: Written in C#, .NET3.5, VS8
Office 2007 plugin: C#, .NET3.5, VS8
Office 2010 plugin: C#, .NET4, VS10
We have officially retired the 2003 version and is nolonger maintaining that. 2007 is being bugfixed when somebody reports anything. 2010 is the "new" black ;)
I may have found a key point
protected override void EnableAddAttachmentsToLegis()
{
// Adds a button on the right click context menu,
// when user clicks on an attachment:
_application.AttachmentContextMenuDisplay
+= new Outlook.ApplicationEvents_11_AttachmentContextMenuDisplayEventHandler
(Application_AttachmentContextMenuDisplay);
}
http://technet.microsoft.com/en-us/query/bb623145 - bummer, good question is now - what replaced it, or was it completely abolished.
Which has been replaced by 2007 - http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook.applicationevents_11_event_members.aspx - which deprecated for 2010.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我以前用outlook的时候也做过类似的事情。我将概述我的步骤:
订阅新邮件事件:
处理程序使用逗号分隔的字符串为您提供所有新邮件的列表。我拆分并处理了每个 id:
processMail 函数检索邮件项并迭代提供所有附件(如果有附件):
processAttachment 函数的核心只是使用保存附件
我的 add 中的函数做了更多工作(例如创建目录结构) ,但基本思想应该已经变得显而易见了。对邮件新事件之外的邮件项目执行此操作可能遵循相同的步骤。
I have done something like this times ago when I was using Outlook. I'm going to outline my steps:
Subscribed to the new mail event:
The handler provides you with a list of all new mails using a comma separated string. I splitted and processed each of the ids:
The processMail function retrieves the mailitem and iterates ofer all attachments if there are attachments:
The processAttachment function's core just saved the attachment using
The functions in my add in do a bit more ( e.g.creating a directory structure ), but the basic idea should have become obvious. Doing this for mail items outside the mail new event is probably following the same steps.