使用Outlook Web插件(Outlook JS API)将电子邮件保存为.msg文件

huangapple go评论43阅读模式
英文:

Save email as .msg file using outlook web add-in ( Outlook JS API )

问题

我打算使用Outlook JS API创建一个Outlook添加程序。我之前使用过VSTO插件。这个功能是由我在VSTO插件中创建的。我试图在Outlook Web添加程序中复制相同的功能。在VSTO插件中,我们有Outlook功能的**_mailItem.SaveAs(...) **,但在Outlook Web插件中没有将电子邮件保存为.msg文件的固有功能。

我已经进行了足够的与此领域相关的研究。我在这方面花费了大量的时间。

如何在Outlook Web添加程序中实现这个功能?

谢谢。

英文:

I'm intending to create an Outlook add-in using the Outlook JS API. I've worked with VSTO add-ons before. This functionality was created in a VSTO add-on by me. I'm trying to duplicate the same functionality in the Outlook web add-in. We have the Outlook functionality of _mailItem.SaveAs(...) in the VSTO add-on, but there is no inherent functionality to save an email as a.msg file in the Outlook web add-on.

I have done enough research related to this area. I have spend ed lots of time in this research.

How do I implement this functionality in the Outlook Web Add-on?

Thanks

答案1

得分: 1

MSG 格式是特定于 Windows 桌面版 Outlook 和扩展 MAPI 的格式 - 它是一个 OLE 存储(IStorage)文件。

您可以使用 EWS(指定 <IncludeMimeContent>true</t:IncludeMimeContent>)或 Graph 访问邮件的 MIME 内容 - Outlook 将愿意打开 EML 文件。有关更多详细信息,请参阅 https://stackoverflow.com/questions/44631907/how-can-i-retrieve-the-full-mime-message-from-an-microsoft-outlook-add-in

请注意,EML 格式不是高保真的,您将丢失无法直接映射到 MIME 属性的 MAPI 特定属性。您可以将项目导出为快速传输流(FTS)格式,但然后您需要将其转换为更可接受的格式,如 MSG 格式。请参阅 https://stackoverflow.com/questions/63512465/any-api-to-read-exchange-fast-transfer-stream。由于 FTS 格式未记录,您需要自行解析它,或者使用类似Redemption(我是其作者)的库来从 FTS 转换为 MSG。

英文:

You can't: MSG format is specific to the Windows desktop version of Outlook and Extended MAPI - it is an OLE Storage (IStorage) file.

You can access MIME content of a message using EWS (specify <IncludeMimeContent>true</t:IncludeMimeContent>) or Graph - Outlook will be happy to open an EML file. See https://stackoverflow.com/questions/44631907/how-can-i-retrieve-the-full-mime-message-from-an-microsoft-outlook-add-in for more details.

Note that EML format is not high-fidelity, and you will miss MAPI-specific properties that cannot be mapped directly to MIME properties. You can export an item in the Fast Transfer Stream (FTS) format, but then you'd need to convert it to something more palatable, such as MSG format. See https://stackoverflow.com/questions/63512465/any-api-to-read-exchange-fast-transfer-stream. And since the FTS format is not documented, you would need to either parse it yourself, or use a library like Redemption (I am its author) to convert from FTS to MSG.

答案2

得分: 1

Office web add-ins(与VSTO或COM add-ins不同)在沙箱中运行,出于安全原因,无法访问本地文件系统。您最好的选择是使用Web浏览器的本地存储。有关可用技术的更多信息,请参阅保持加载项状态和设置

因此,Office JavaScript API不提供任何SaveAs方法,您可以在COM add-ins中使用。您可以在Tech Community上发布或投票现有的功能请求,这些请求在Office开发团队进行规划过程时会被考虑。

请注意,您可以在需要时使用EWS或Graph API从Exchange服务器访问项目。

英文:

Office web add-ins (unlike VSTO or COM add-ins) are run in a sandbox which doesn't have access to the local file system for security reasons. The best what you could do is to use a local storage of the web browser. See Persist add-in state and settings for more information about available techniques.

For that reason the Office JavaScript API doesn't provide any SaveAs method which you could use in COM add-ins. You can post or vote for an existing feature request on Tech Community where they are considered when the Office dev team goes through the planning process.

Note, you can use EWS or Graph API for accessing items when required from the Exchange server.

huangapple
  • 本文由 发表于 2023年4月4日 17:15:47
  • 转载请务必保留本文链接:https://go.coder-hub.com/75927574.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定