0

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

Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45
Pratik Ratanpara
  • 338
  • 2
  • 15

2 Answers2

1

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.

Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45
0

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

You can access the MIME content of a message using EWS (specify <IncludeMimeContent>true</t:IncludeMimeContent>) or Graph - Outlook will be happy to open an EML file. See 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 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.

Dmitry Streblechenko
  • 62,942
  • 4
  • 53
  • 78