简体   繁体   English

Mac Outlook客户端-Office365加载项-固定-Office.initialize不回叫

[英]Mac outlook client - Office365 add-in - Pinning - Office.initialize is not calling back

I am working on developing simple outlook add-in with pinning support. 我正在开发具有固定支持的简单Outlook加载项。 The add-in works fine in windows outlook, chrome and IE. 该加载项在Windows Outlook,Chrome和IE中正常运行。 But when we try it in mac outlook client the behaviour is completely different. 但是,当我们在mac Outlook客户端中尝试该行为时,其行为是完全不同的。

  1. Create a add-in with pinning support. 创建具有固定支持的加载项。

  2. Open up the add-in and pin it. 打开外接程序并将其固定。

  3. Change emails 更改电子邮件

  4. Switch from inbox to sent items and immediately click on another email. 从收件箱切换到已发送邮件,然后立即单击另一封电子邮件。

Now If we observe closely the Office.initialize call back will not called back. 现在,如果我们仔细观察,则不会回调Office.initialize回调。

Please use following code for debugging. 请使用以下代码进行调试。

var isInitialized = false;
Office.initialize = function(reason) {
    console.log('Office initialize callback is getting fired from outlook');
    document.getElementById('status').innerHTML = 'Office is loaded 1';
    isInitialized = true;
};
var attempt = 0; 
var checkOfficeIsInitialized = function() {
    console.log('checking office', attempt);
    setTimeout(function() {
        console.log('is window intialized', isInitialized);
        if (!isInitialized && attempt < 45) {
            attempt++;
            checkOfficeIsInitialized();
        } else {
            if (!isInitialized) {
                document.getElementById('status').innerHTML = 'Failed to initialize outlook';
            } else {
                document.getElementById('status').innerHTML = 'Office is loaded 2';
            }
        }
    }, 1000);
}
checkOfficeIsInitialized();

Here is the html 这是HTML

<!doctype html>
<html>
    <head>
        <title>Tetsing</title>
    </head>
    <body>
        <h3 id="status">Loading....</h3>
        <script src="https://appsforoffice.microsoft.com/lib/1.1/hosted/office.js" type="text/javascript"></script>
        <script src="js/public-login-v2.js" type="text/javascript"></script>
    </body>
</html>

Office.initialize callback will run only once when the add-in opens. 加载项打开时,Office.initialize回调仅运行一次。 After pinning the add-in, the callback is not supposed to be called every time when switching between messages. 固定加载项之后,不应在每次在消息之间切换时都调用回调。 However, you can register ItemChanged event through addHandlerAsync to get update when message changes. 但是,您可以通过addHandlerAsync注册ItemChanged事件,以在消息更改时获取更新。 Please find more details here . 在此处找到更多详细信息。

This was a bug that we fixed recently. 这是我们最近修复的错误。 Switching between folders should no longer cause the add-in to re-initialize. 在文件夹之间切换不应再导致加载项重新初始化。 If you have opted in for the Insider Fast builds, you should have this fix already. 如果您选择了Insider Fast构建,则应该已经有此修复程序。 If not, the fix would be rolled out in some time. 如果没有,此修复程序将在一段时间后推出。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM