'Downloading Email body and attchments in .MSG format in Web Outlook

Is it possible to download email body and attachments in a file in .MSG format in Outlook Web? I am working on an Outlook 365 Web addin and I require to download entire message along with attachments in .MSG format?

Edit: Is there any open source library in .NET which does the same?

Thanks,



Solution 1:[1]

I have to do the same thing, but since the company I'm writting the addin for is using a version of Windows/MSOffice where the webview that the addin runs inside is handled by a IE11 process, I got OOM-error when trying to download an attachment bigger than 7MB via a EWS request (using the ews-javascript-api).

Now I'm using a IIS server to which I send the eschangeToken and EmailId and handle the download/upload of the email there via EWS-managed-api from MS.

Downloading the email as .MSG is not possible AFAIK, I download them by getting the MIME-content of the email and saving it as an .EML file.

Here MS provides some examples on how to use the ews-managed-api.

Solution 2:[2]

EWS cannot convert to MSG. You can try to save in the Fast Transfer Stream format using the ExportItems EWS operation (which, just like the MSG format, preserves most properties). The EML format, on the other hand, will not preserve MAPI specific properties. The FTS data can then be converted (without any loss of fidelity) to the MSG format using Redemption (I am its author - RDOSession.CreateMessageFromMsgFile / RDOMail.Import(..., olFTS) / RDOMail.Save), but since Redemption is a native COM library, that code would have to run on your server, not inside the browser.

RDOSession session = new RDOSession();
RDOMail msg = session.CreateMessageFromMsgFile(@"c:\temp\test.msg");
msg.Import(@"c:\temp\test.fts", rdoSaveAsType.olFTS);
msg.Save();

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2