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!
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!
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.
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.....