Office.context.mailbox.item.body.getAsync() 方法在 outlook mac 2016 中不起作用

Office.context.mailbox.item.body.getAsync() method does not work in outlook mac 2016

在 office 365 outlook 加载项中,Office.context.mailbox.item.body.getAsync() 方法在 outlook Mac 中不起作用。但它在 safarichrome.

中运行良好

office js 引用是“https://appsforoffice.microsoft.com/lib/1/hosted/office.js

这里是插件读取应用的代码

     var _item = Office.context.mailbox.item;
     var body = _item.body;
        // Get the body asynchronous as text
        body.getAsync(Office.CoercionType.Text, function (asyncResult) {
            if (asyncResult.status !== Office.AsyncResultStatus.Succeeded) {
            }
            else {
                $('#subject').html(asyncResult.value.trim());
            }
        });         

该功能是要求集 1.3 的一部分; Mac add ins only support requirement set 1.1

遇到了同样的问题,但有解决方法。您可以使用要求集 1.1 中提供的 makeEwsRequestAsync() 方法来实现此目的。这需要您发出 SOAP 请求并解析响应数据以获取电子邮件正文。在 SOAP 请求中,使用:

    '        <t:AdditionalProperties>' +
    '            <t:FieldURI FieldURI="item:TextBody"/>' +
    '        </t:AdditionalProperties>' +

这将 return 一个您可以解析的响应。

供参考: https://dev.outlook.com/reference/add-ins/1.1/Office.context.mailbox.html#makeEwsRequestAsync