Outlook Mail加载项读取正文内容错误



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

这就是我根据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);
  }
);