从 O365 排除安装插件

问题描述 投票:0回答:1

我有一个 macOS 上的 Outlook 插件的清单文件,需要 o356 才能部署到用户邮箱。

但是,我遇到了一个小问题,因为我的一些用户拥有同时运行 macOS 和 Windows 的工作站。 当我安装该附加组件时,它会为用户安装在两台计算机上。

但是,该附加组件是为 MacOS 设计的,当安装在 Windows 上时,它会导致 Outlook 的效率出现问题。

您遇到过这个问题吗?

在添加到 LessFunctionFileUrl 的 JavaScript 脚本中,我包含了操作系统验证。

function operatingSytem() { 
    var contextInfo = Office.context.diagnostics;
    printLog('Office application: ' + contextInfo.host)
    printLog('Platform: ' + contextInfo.platform)
    printLog('Office version: ' + contextInfo.version)

    // To debug into web broswer console 
    // add the comparison below into the if condition
    //contextInfo.platform == 'OfficeOnline'
    if(contextInfo.platform == 'Mac'){
        return 'MacOS';
    }
    return 'Other'
}

function validateBody(event) {
    Office.onReady().then(function() {
        //TODO The message id must be changed to proper replace the message 
        // "Addin is working on your request."
        //Office.context.mailbox.item.notificationMessages.replaceAsync("succeeded", {
            //type: "progressIndicator",
            //message: "Microsoft is working on your request.",
        //});
        printLog(" email validation started - [v1.2]")
        //Execute the add-in logic only if it is Outlook application running on MacOS
        if(operatingSytem() == "MacOS"){
            printLog("MacOS detected")
            validate(event).catch(data => {handleError(data, event)});
        } else{
            printLog("OS is not MacOS")
            handleError("Not MacOS", event);
        }
    });
}

不幸的是,这只能让附加组件无法分析电子邮件。并且在安装本身之后问题就开始出现。

office-js outlook-addin manifest office-addins outlook-web-addins
1个回答
0
投票

您似乎试图通过在运行时检查 Office.Context 接口的

platform
属性来避免加载项在 Windows 上执行其业务逻辑。您可以检查平台并设置是否运行加载项回调的标志。此标志可在加载项回调中使用,而不是在
onReady
回调中使用来运行验证逻辑。

© www.soinside.com 2019 - 2024. All rights reserved.