【发布时间】:2017-01-04 20:21:09
【问题描述】:
我正在开发适用于 Outlook 2016 的 Office365 插件,它允许用户使用任务窗格中的按钮更改电子邮件的正文。
任务窗格中的 HTML:
<p><button onclick="createLongBody()">Set Long Body</button></p>
<p><button onclick="createShortBody()">Set Short Body</button></p>
<div id="status"></div>
在 Javascript 中:
function createLongBody() {
var longText = "<html><body>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/>Hello<br/></body></html>";
Office.context.mailbox.item.body.setAsync(longText, { coercionType: Office.CoercionType.Html }, function () {
$("#status").html("Long email complete!");
});
};
function createShortBody() {
Office.context.mailbox.item.body.setAsync("<html><body><h1>Hello</h1></body></html>", { coercionType: Office.CoercionType.Html }, function () {
$("#status").html("Short email complete!");
});
复制:
- 点击“创建长体”按钮
- 滚动到底部,将光标放在电子邮件末尾
- 点击“创建短正文”按钮
结果:
状态文本更改为“短电子邮件完成”,但没有出现新的短电子邮件 - 正文只是空白。
我不确定这是否是 Office 插件 API 错误,但我想将它呈现给社区,看看是否有人有任何想法? 其他人可以复制吗?谢谢!
用 HTML/JS 编辑以复制
【问题讨论】:
标签: ms-office office365 outlook-addin