简体   繁体   English

无法使用第三方应用程序将 MailItem 另存为 msg 文件

[英]Unable to SaveAs MailItem as msg file using third party application

I have vsto Addon for outlook.我有 outlook 的 vsto 插件。 In my addon, there is a functionality to save mail items locally.在我的插件中,有一个功能可以在本地保存邮件。 This functionality is worked in the background automatically.此功能在后台自动运行。 To implement this functionality, I have developed one background application.为了实现这个功能,我开发了一个后台应用程序。 In this application, I will save the email in a decided folder.在这个应用程序中,我会将 email 保存在一个确定的文件夹中。 This add-on works fine for my computer but in some of client-facing an issue while saving email.这个附加组件在我的电脑上工作得很好,但在保存 email 时,在一些面向客户端的问题中。 As per the log files, I have checked when I tried to save email this error is generated.根据日志文件,我在尝试保存 email 时检查了此错误是否生成。

Operation aborted (Exception from HRESULT: 0x80004004 (E_ABORT))操作中止(HRESULT 异常:0x80004004 (E_ABORT))

Before publishing this blog, I have tried to get a fresh mail item using Outlook.在发布此博客之前,我尝试使用 Outlook 获取新邮件。 Application object but still the issue is not fixed.申请 object 但问题仍未解决。

Can anyone please help us to solve this issue?谁能帮我们解决这个问题?

Thanks谢谢

Outlook Object Model cannot be used from a secondary thread in the outlook.exe process address space. Outlook Object Model 不能从 ZCD0FBB7849B9D81ECFZ8E 进程空间中的辅助地址线程使用。 You can use it from a secondary thread in an external process, but then the call will be marshaled to the main Outlook thread anyway.您可以从外部进程中的辅助线程使用它,但无论如何调用将被编组到主 Outlook 线程。 There is no marshaling in-proc, hence you get an error.进程内没有封送处理,因此您会收到错误消息。

Your options are Extended MAPI (C++ or Delphi only) or Redemption (can be used in any language).您的选项是扩展 MAPI(仅限 C++ 或 Delphi)或赎回(可用于任何语言)。 In the latter case, you can save the value of the Namespace.MAPIOBJECT and MailItem.EntryID properties in separate variables on the main thread, and on the secondary thread create an instance of the RDOSession object, set its MAPIOBJECT property to the value saved on the main thread, open then message using RDOSession.GetMessageFromID , then call RDOMail .在后一种情况下,您可以将Namespace.MAPIOBJECTMailItem.EntryID属性的值保存在主线程上的单独变量中,并在辅助线程上创建RDOSession object 的实例,将其MAPIOBJECT属性设置为保存在主线程,然后使用RDOSession.GetMessageFromID打开消息,然后调用RDOMail SaveAs(..., olMsg) . SaveAs(..., olMsg)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM