Skip to content

Instantly share code, notes, and snippets.

Created May 24, 2019 00:49
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Sample demonstrating use of simpleMIMEClass
function sampleOfficeEvent(event){
/** @type {Office.Types.ItemCompose} */
var item = Office.cast.item.toItemCompose(Office.context.mailbox.item);
item.saveAsync(function(idResult) {
function(mimeResult) {
/** {@type (simpleMIMEClass)} */
var oMime = new simpleMIMEClass();
var doc = $(oMime.HTML()); // load into an HTML document
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment