如何在Outlook 365 Web加载项中获取电子邮件的.eml或base 64? [英] How to get .eml or base 64 of an email message in outlook 365 web addin?
问题描述
我要创建一个Outlook Web加载项,我要在其中添加电子邮件及其附件列表的.eml和.txt吗?我对EWS,Outlook RestAPI和MS Graph API进行构建感到困惑.我尝试使用EWS,但是有两个问题:
I want to create an outlook web add-in ,in which I want .eml and and .txt of the email message and its attachment list? I am confused between EWS , Outlook RestAPI and MS Graph API to build it. I tried using EWS , but it had two issues:
-
在何处获得这些凭据,(一个示例会有所帮助)
where to get these credentials ,(an example would be helpful)
service =新的ExchangeService{凭据=新的WebCredentials(OutlookEmailId,密码)
service = new ExchangeService { Credentials = new WebCredentials(OutlookEmailId, Password)
};
EWS现在已过时.
EWS are obsolete now.
那么获取电子邮件内容的正确方法是什么?谁能用简单的英语解释这些步骤.此外,任何示例都将对您大有帮助.
So what is the right way of getting the email message content ? Could anyone please explain the steps in plain english. Also, any example would be a big help to start.
我是这些集成和OAUTH概念的新手,请提出建议.我想朝着正确的方向努力.
I am newbie in these integration and OAUTH concepts, please suggest. I want to put my efforts in right direction.
推荐答案
- EWS并不是过时的(并且不会使用一段时间),只是基本的Auth已被弃用,这应该是Modern Addin中的一个问题.
您可以使用Graph获取消息的Mime内容(基本上是EML文件的内容),例如 https://github.com/OfficeDev/Outlook-Add-in-SSO 具有非常全面的示例,您只需更改一些REST调用即可完成所需的操作.
You can get the Mime content of a Message (which is basically what is the content of an EML file) using the Graph eg https://docs.microsoft.com/en-us/graph/outlook-get-mime-message. To use that in a Addin you need to use make use of SSO see https://github.com/OfficeDev/Outlook-Add-in-SSO which has a pretty comprehensive sample you just need to change some of the REST call to do what you want.
在 https://gsexdev.blogspot.com/2019/05/outlook-addin-for-exporting-email-to.html (此限制为1MB)
If you trying to go past 1MB there a few options to take with EWS use the answer in How can I retrieve the full MIME message from an Microsoft Outlook Add-In?.
这篇关于如何在Outlook 365 Web加载项中获取电子邮件的.eml或base 64?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!