Outlook 邮件插件阅读正文内容错误

Outlook Mail addin reading body content error

我正在尝试开发一个 Outlook mail addin 来访问电子邮件的正文内容。

这就是我根据 Documentation provided by MSDN 编写 JavaScript 代码的方式。

        Office.context.mailbox.item.body.getAsync("html", function(result){

            $("#mytext3").val(result);

        });

当我使用 chrome 进行调试时,这是我发现的错误消息。

Uncaught Sys.ArgumentException: Sys.ArgumentException: Value does not fall within the expected range.

参数名称:选项

我做错了什么?

调用应该有效(我刚刚试过了),但是传递给回调的 result 是一个对象,正文在 result.value.

您可以尝试传递一个 options 参数,例如:

Office.context.mailbox.item.body.getAsync(
  "html", 
  { asyncContext: "This is passed to the callback" },
  function(result){
    $("#mytext3").val(result.value);
  }
);