office.js,office.context.mailbox.item.cc.getAsync不起作用

发布于 2025-02-05 20:20:49 字数 2182 浏览 2 评论 0原文

我正在努力使用Office-JS创建Outlook加载项。

我需要获取CC和电子邮件。

由于我阅读了这些页面,所以我编写了此代码。但是,当cc.getAsync和to.getAsync毫无用处时,getAsync返回收集消息的身体。 https://learn.microsoft.com/ja-jp/javascript/api/requirement-sets/requirement-sets/requirement-setlook/requirement-set-set-set-1.5/office.context.context.mailbox.mailbox.itembox.item? JS-Preview https://learn.microsoft.com/en-us/javascript/api/opi/oflook/office.recipients?view=Outlook-js-1.5&ppreserve-view = True

// It does not work though I expect to appear cc of the message on taskpane of my add-in
 const item = Office.context.mailbox.item;
 item.cc.getAsync(function (asyncResult) {
      if (asyncResult.status === Office.AsyncResultStatus.Succeeded) {
        document.getElementById("message").innerHTML = `<h2 class="message">${asyncResult.value}</h2>`;
        document.getElementById("message").style.visibility = "visible";
      }
    });
// same here
const item = Office.context.mailbox.item;
item.to.getAsync(function (asyncResult) {
      if (asyncResult.status === Office.AsyncResultStatus.Succeeded) {
        document.getElementById("message").innerHTML = `<h2 class="message">${asyncResult.value}</h2>`;
        document.getElementById("message").style.visibility = "visible";
      }
    });

// on the other hand, I can see the body of  the message on my taskpane
item.body.getAsync(Office.CoercionType.Html, function callback(result) {
    if (result.status === Office.AsyncResultStatus.Succeeded) {
      document.getElementById("message").innerHTML = `<h2 class="message">${result.value}</h2>`;
      document.getElementById("message").style.visibility = "visible";
    }
  });

I'm working to create a Outlook add-in using office-js.

I need to get cc and to of an e-mail message.

Since I read these pages, I write this code. However, when cc.getAsync and to.getAsync works nothing whereas body.getAsync returns collect body of the message.
https://learn.microsoft.com/ja-jp/javascript/api/requirement-sets/outlook/requirement-set-1.5/office.context.mailbox.item?view=common-js-preview
https://learn.microsoft.com/en-us/javascript/api/outlook/office.recipients?view=outlook-js-1.5&preserve-view=true

// It does not work though I expect to appear cc of the message on taskpane of my add-in
 const item = Office.context.mailbox.item;
 item.cc.getAsync(function (asyncResult) {
      if (asyncResult.status === Office.AsyncResultStatus.Succeeded) {
        document.getElementById("message").innerHTML = `<h2 class="message">${asyncResult.value}</h2>`;
        document.getElementById("message").style.visibility = "visible";
      }
    });
// same here
const item = Office.context.mailbox.item;
item.to.getAsync(function (asyncResult) {
      if (asyncResult.status === Office.AsyncResultStatus.Succeeded) {
        document.getElementById("message").innerHTML = `<h2 class="message">${asyncResult.value}</h2>`;
        document.getElementById("message").style.visibility = "visible";
      }
    });

// on the other hand, I can see the body of  the message on my taskpane
item.body.getAsync(Office.CoercionType.Html, function callback(result) {
    if (result.status === Office.AsyncResultStatus.Succeeded) {
      document.getElementById("message").innerHTML = `<h2 class="message">${result.value}</h2>`;
      document.getElementById("message").style.visibility = "visible";
    }
  });

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文