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

做~自己de王妃 提交于 2021-01-27 04:41:19

问题


In office 365 outlook add-in, Office.context.mailbox.item.body.getAsync() method does not work in outlook Mac. But it works fine in safari and chrome.

office js reference is "https://appsforoffice.microsoft.com/lib/1/hosted/office.js"

here is the code of add-in read app

     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:


That function is part of requirement set 1.3; the Mac add ins only support requirement set 1.1.




回答2:


Had the same issue but there is a workaround. You could achieve this with makeEwsRequestAsync() method, which is provided in requirements set 1.1. This requires you to make a SOAP request and to parse the response data to get the email body. In the SOAP request, use:

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

This will return a response that you can parse.

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



来源:https://stackoverflow.com/questions/36499958/office-context-mailbox-item-body-getasync-method-does-not-work-in-outlook-mac

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!