Javascript 使用Office Js将图像作为多部分/相关MIME对象添加到Outlook Addin

Javascript 使用Office Js将图像作为多部分/相关MIME对象添加到Outlook Addin,javascript,office-js,Javascript,Office Js,我正在使用outlook 2016将图像作为附件添加到电子邮件中。有没有办法指定附件选项?我看到有一个类型,我可以用这个来指定其他选项吗?我的目标是使用多部分/相关MIME对象嵌入图像。内联图像目前在平台上没有很好的支持。我们正在努力改进这一点。同时,您可以包括“, {impressionType:Office.impressionType.Html, asyncContext:{var3:1,var4:2}, 函数(异步结果){ 如果(asyncResult.status== Office.A

我正在使用outlook 2016将图像作为附件添加到电子邮件中。有没有办法指定附件选项?我看到有一个类型,我可以用这个来指定其他选项吗?我的目标是使用多部分/相关MIME对象嵌入图像。

内联图像目前在平台上没有很好的支持。我们正在努力改进这一点。同时,您可以包括
“,
{impressionType:Office.impressionType.Html,
asyncContext:{var3:1,var4:2},
函数(异步结果){
如果(asyncResult.status==
Office.AsyncResultStatus.Failed){
showMessage(asyncResult.error.message);
}
否则{
//已成功设置项正文中的数据。
//做任何适合您的场景的事情,
//使用参数var3和var4(如适用)。
}
});
}
});

您正在尝试插入内联图像,是吗?是的,主要目标是插入用于签名的图像。感谢您提供的代码示例。我在outlook中尝试过,但它似乎不起作用。要使cid引用起作用,您必须将内容作为base64附加。
Office.context.mailbox.item.addFileAttachmentAsync(
"http://smartbuildings.unh.edu/wp-content/uploads/2015/06/Winter-Tiger-Wild-Cat-Images-1024x576.jpg",
"Winter-Tiger-Wild-Cat-Images-1024x576.jpg",
{asyncContext: null},
function (asyncResult) 
 {
  if (asyncResult.status == "failed") {
    //showMessage("Action failed with error: " + asyncResult.error.message);
  }
  else
{ 
Office.context.mailbox.item.body.setSelectedDataAsync(
                        "<img src='cid:Winter-Tiger-Wild-Cat-Images-1024x576.jpg'>",
                        { coercionType: Office.CoercionType.Html, 
                        asyncContext: { var3: 1, var4: 2 } },
                        function (asyncResult) {
                            if (asyncResult.status == 
                                Office.AsyncResultStatus.Failed){
                                showMessage(asyncResult.error.message);
                            }
                            else {
                                // Successfully set data in item body.
                                // Do whatever appropriate for your scenario,
                                // using the arguments var3 and var4 as applicable.
                            }
                        });

}
});