javascript - image thumbnails not showing in outlook mail body through add-in in desktop version of 2013 or 2016 -


image thumbnails not showing in outlook email body in text format through add-in in desktop version of 2013 or 2016. code working fine in online version of outlook in desktop version of outlook seems not working images issue shown code snippet mentioned below:

    try {                            var filename = office.prototype.checkextension(imageurl);             if (office.context.mailbox) {                 var imageurldec = decodeuricomponent(imageurl);                 imageurldec = imageurl.replace(/\ /g, '%20');                                   var img = '<img src=' + imageurl + ' />';                 var outlookdiv = '';                 var thumpimage = '<img src="' + thumbs + '" alt="' + imagename + '" >';                  if (assettype == 'image') {                      outlookdiv = ' <div><a href=' + imageurldec + ' target="_blank">' + thumpimage + '</a></div>';                     office.prototype.outlookimageinsert(outlookdiv, imageurl, imagename, spanid, assetid, thumbs, assettype);                 } else if (assettype == 'video') {                      thumpimage = '<img src="' + thumbs + '" style="width:204px;height:128px;"  alt="' + imagename + '" >';                     outlookdiv = ' <div><a href=' + imageurldec + ' target="_blank">' + thumpimage + '</a></div>'; office.prototype.outlookvideoinsert(outlookdiv, imageurl, imagename, spanid, assetid, thumbs, assettype);                 } else if (assettype == 'audio') {                     thumpimage = '<img src="' + thumbs + '" style="width:204px;height:128px;"  alt="' + imagename + '" >'; outlookdiv = ' <div><a href=' + imageurldec + ' target="_blank"><div ><div ></div>' + thumpimage + '</a></div>';                  if (windowurl[1] == "web") {                      var appname = windowurl[0].split('_host_info=');                     if (appname[1].tolowercase() == 'powerpoint' || appname[1].tolowercase() == 'word') {                         var base64 = office.prototype.imagetobase64(imageurl);                         $.when(base64).done(function (data) {                             if (data != null) {                                 var b64str = data.data;                                 b64str = b64str.split('data:image/png;base64,');                                 office.context.document.setselecteddataasync(b64str[1], {                                     coerciontype: office.coerciontype.image,                                     imageleft: 0,                                     imagetop: 0,                                 },                                     function (asyncresult) {                                         if (asyncresult.status === office.asyncresultstatus.failed) {                                          }                                     });                             }                         }).fail(function (data) {                         });                     }                 } else {                     office.context.document.getselecteddataasync(office.coerciontype.html,                         function (result) {                             if (result.status === office.asyncresultstatus.failed) {                                 var base64 = office.prototype.imagetobase64(imageurl);                                 $.when(base64).done(function (data) {                                     if (data != null) {                                         var b64str = data.data;                                         b64str = b64str.split('data:image/png;base64,');                                         office.context.document.setselecteddataasync(b64str[1], {                                             coerciontype: office.coerciontype.image,                                             imageleft: 0,                                             imagetop: 0,                                         },                                             function (asyncresult) {                                                 if (asyncresult.status === office.asyncresultstatus.failed) {                                                     var divid = "officeinsertimg" + assetid;                                                     var div = document.getelementbyid(divid);                                                     var controlrange;                                                     var scrollposition = $(window).scrolltop();                                                     if (document.body.createcontrolrange) {                                                         controlrange = document.body.createcontrolrange();                                                         controlrange.addelement(div);                                                         controlrange.execcommand('copy');                                                         controlrange.execcommand('paste');                                                         $('#' + spanid).css('display', 'inline');                                                         $('#' + spanid).html('your asset has been copied on clipboard , can paste document using cntr+v or paste in contexual menu')                                                         settimeout(function () {                                                             $('#' + spanid).css('display', 'none');                                                         }, 5000);                                                     }                                                     $("html, body").animate({ scrolltop: scrollposition }, "slow");                                                 }                                             });                                     }                                 }).fail(function (data) {                                 });                               } else {                                 var imghtml = "<img " + "src='" + imageurl + "'" + " alt ='apps office image' height='200px' width='200px' img/>";                                 office.context.document.setselecteddataasync(                                     imghtml, { coerciontype: "html" },                                     function (asyncresult) {                                         if (asyncresult.status == "failed") {                                             write('error: ' + asyncresult.error.message);                                         }                                     });                             }                         }                     );                 }             }         } catch (e) {             $('#errormessagediv').css('display', 'block');             $('#errormessagediv').html('error in insertion of image');         }     } 

i'd appreciate problem is. thanks


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -