Java 将Microsoft GraphAPI OutlookItem响应另存为eml

Java 将Microsoft GraphAPI OutlookItem响应另存为eml,java,microsoft-graph-api,office365api,microsoft-graph-sdks,Java,Microsoft Graph Api,Office365api,Microsoft Graph Sdks,我使用的GraphAPI版本如下: //Microsoft graph API dependencies compile group: 'com.microsoft.graph', name: 'microsoft-graph', version: '3.0.0' // https://mvnrepository.com/artifact/com.azure/azure-identity compile group: 'com.azure', name: 'azure-identity'

我使用的GraphAPI版本如下:

    //Microsoft graph API dependencies
compile group: 'com.microsoft.graph', name: 'microsoft-graph', version: '3.0.0'
// https://mvnrepository.com/artifact/com.azure/azure-identity
compile group: 'com.azure', name: 'azure-identity', version: '1.2.5'
我们有一些场景,其中.msg(outlook)附件出现在电子邮件中。很遗憾,对于.msg/.eml文件类型,此ItemAttachment响应的内容字节不可用

我能够使用下面的调用并获得Mime响应

https://graph.microsoft.com/v1.0/me/messages/<MessageID>/attachments/<AttachmentId>/$value

谢谢。

我相信您正在使用Microsoft Graph Client/SDK,然后您可以尝试以下方法:(1)获取消息的mime内容(2)然后将流写入物理磁盘,如下所示,这将保存.eml(不确定如何格式化这里的代码片段,但我会在您确认后移动到应答时这样做):string path=@“\my_path\tobesavedfile.eml”;使用(FileStream outputFileStream=new FileStream(path,FileMode.Create)){stream.CopyTo(outputFileStream);}(3)测试它是否有用。
byte [] result = Base64.getMimeDecoder().decode(bytes);