1

I need to extract the message source of an email present in the office 365 outlook account in to my javascript app. Is there any method/api to do so? Message source with complete headers and body parts.

Thanks!

Spartan
  • 191
  • 1
  • 9

2 Answers2

0

There isn't a way to do this today using Office 365 REST APIs. If you can explain your scenario, we may be able to suggest an alternate route.

Venkat Ayyadevara - MSFT
  • 2,850
  • 1
  • 14
  • 11
  • I want to create a text file of the message source which I can attach to a new mail and forward it further. The text file should comply with the rfc822 message format. – Spartan Aug 19 '15 at 17:59
0

you can use the make an EwsRequest:

                function getEmailEWSAsync() {
                var item = Office.context.mailbox.item;
                // Create a local variable that contains the mailbox.
                var result =
                       '<?xml version="1.0" encoding="utf-8"?>' +
                       '<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' +
                       '               xmlns:xsd="http://www.w3.org/2001/XMLSchema"' +
                       '               xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"' +
                       '               xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">' +
                       '  <soap:Header>' +
                       '    <RequestServerVersion Version="Exchange2013" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" soap:mustUnderstand="0" />' +
                       '  </soap:Header>' +
                       '  <soap:Body>' +
                       '    <GetItem xmlns="http://schemas.microsoft.com/exchange/services/2006/messages">' +
                       '      <ItemShape>' +
                       '        <t:BaseShape>IdOnly</t:BaseShape>' +
                       '        <t:IncludeMimeContent>true</t:IncludeMimeContent>' +
                       '        <t:AdditionalProperties>' +
                       '            <t:FieldURI FieldURI="item:MimeContent"/>' +
                       '            <t:FieldURI FieldURI="item:Categories"/>' +
                       '            <t:FieldURI FieldURI="item:DateTimeSent"/>' +
                       '            <t:FieldURI FieldURI="item:DateTimeReceived"/>' +
                       '        </t:AdditionalProperties>' +
                       '      </ItemShape>' +
                       '      <ItemIds><t:ItemId Id="' + Office.context.mailbox.item.itemId + '"/></ItemIds>' +
                       '    </GetItem>' +
                       '  </soap:Body>' +
                       '</soap:Envelope>';
                Office.context.mailbox.makeEwsRequestAsync(result, callback);


            }

The asynchronous call will give you the MimeContent which is the origin message (message/rfc822). But be aware: those addins will not work on mobile devices since EWS is not available and the REST API does not allow to get the MimeContent.....

TheShadow
  • 581
  • 4
  • 10