Office.context.mailbox.diagnostics.hostName在Mac上为Outlook返回不正确的值

时间:2017-03-16 00:32:43

标签: office-js

使用OfficeJS确定正在使用的办公室客户端时,我正在调用Office.context.mailbox.diagnostics.hostName,但是当我希望得到Outlook Mac Outlook >

根据https://github.com/OfficeDev/office-js-docs/blob/master/reference/outlook/Office.context.mailbox.diagnostics.mdhostname的可能值可以是OutlookMac OutlookOutlookIOSOutlookWebApp

我正在使用https://appsforoffice.microsoft.com/lib/1/hosted/office.js

中的最新OfficeJ

3 个答案:

答案 0 :(得分:0)

我们正在努力解决此问题。同时,作为一种解决方法,您可以在添加中使用useragent来识别浏览器。一旦此问题得到解决,我们会立即通知您。

答案 1 :(得分:0)

documentation已更改为删除对Mac Outlook的任何提及。现在建议在Mac客户端上输出为Outlook

答案 2 :(得分:0)

当前,您可以使用浏览器UserAngent来检测Outlook for Mac上正在运行的加载项。

Office.initialize = function () {
    //if Add-in is opening in Outlook App for MAC.
    var OutlookHost = Office.context.mailbox.diagnostics.hostName;
    var platform = navigator.platform;
    if (OutlookHost !== null && OutlookHost !== undefined && OutlookHost === "Outlook" && platform != null && platform.toLowerCase().indexOf("mac") >= 0) {
        return true;
    }
 }

navigator.platform将返回:

"MacIntel"
相关问题