Sample demonstrating use of simpleMIMEClass
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sampleOfficeEvent(event){ | |
/** @type {Office.Types.ItemCompose} */ | |
var item = Office.cast.item.toItemCompose(Office.context.mailbox.item); | |
item.saveAsync(function(idResult) { | |
easyEws.getMailItemMimeContent(idResult.value, | |
function(mimeResult) { | |
/** {@type (simpleMIMEClass)} */ | |
var oMime = new simpleMIMEClass(); | |
oMime.Parse(mimeResult); | |
var doc = $(oMime.HTML()); // load into an HTML document | |
console.clear(); | |
console.log("MIME: " + oMime.Text()); // get the raw MIME text | |
console.log("HEADER: " + oMime.FullHeader()); // get the full header info | |
console.log("HTML: " + oMime.HTML()); // return just the HTML | |
// here we are looking for the first image in the HTML document | |
var id = doc.find("img").attr("src"); | |
// we display the SRC - which is a CID | |
console.log("TAG: " + id); | |
// Then we display the BASE64 string data for the image | |
// which can be converted to an image, replaced in the src tag | |
// to make it inline or store offline | |
console.log("DATA: " + oMime.GetImageData(id)); | |
// done | |
event.completed(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment