0

My previous VSTO can output the .msg file. But can this be achieved in the new web add-in?

Any code examples?

I am currently using office.js in the front end and EWS managed API in the back end.

Instruction

I have found the above post saying something about that but I cannot integrate into my back end.

Frostless
  • 818
  • 1
  • 11
  • 33
  • Could you tell us more if EML (as indicated in instruction) is enough for you need? Could you also tell us the issues you face trying to use on your backend and if using REST is an option for you? – Outlook Add-ins Team - MSFT Aug 25 '18 at 18:27
  • @OutlookAdd-insTeam-MSFT I would prefer .msg over eml at this moment because that is what I provide for clients in my current vsto add-in. I might have to settle for eml if msg is to hard to get. The problem I am facing for fetching eml/msg in the back end is I do not know where to start. Currently I use EWS managed API to get the binary data of the attachments. But that is based on the attachment token provided from the front end. So for the msg/eml do I need anything beforehand to call the API? – Frostless Aug 26 '18 at 01:46

1 Answers1

0

Turns out I need to get the itemID first to get the EmailMessage .

ExchangeService service = new ExchangeService();
service.Url = new Uri(ewsUrl);
service.Credentials = new OAuthCredentials(ewsToken);
EmailMessage em = EmailMessage.Bind(service, new ItemId(itemID));

I can use Office.js from the front end to gather those prerequisite info(ewsUrl,ewsTokenitemID)

At this point I can just load the eml by

email.Load(new PropertySet(ItemSchema.MimeContent));
MimeContent mimcon = email.MimeContent;
Frostless
  • 818
  • 1
  • 11
  • 33