Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/99.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Office无法加载仅适用于IOS的Outlook web插件_Ios_Outlook Web Addins - Fatal编程技术网

Office无法加载仅适用于IOS的Outlook web插件

Office无法加载仅适用于IOS的Outlook web插件,ios,outlook-web-addins,Ios,Outlook Web Addins,在我的插件中,我使用outlook对话框API实现了登录功能。 它加载一个带有返回url的凭证表单(不在我的控件中)。登录响应正确地出现在我的节点服务器上,我看到用户已通过身份验证。在服务器上,准备了一个ejs文件并将其发送到客户机。回到客户端,我想执行messageParent,这样我就可以关闭对话框了这适用于浏览器(包括safari)、android、桌面等,适用于Outlook for MAC,但不适用于iOS。以下示例代码: 在nodejs中: app.post("/auth/:toke

在我的插件中,我使用outlook对话框API实现了登录功能。 它加载一个带有返回url的凭证表单(不在我的控件中)。登录响应正确地出现在我的节点服务器上,我看到用户已通过身份验证。在服务器上,准备了一个ejs文件并将其发送到客户机。回到客户端,我想执行messageParent,这样我就可以关闭对话框了这适用于浏览器(包括safari)、android、桌面等,适用于Outlook for MAC,但不适用于iOS。以下示例代码:

在nodejs中:

app.post("/auth/:token", (req, res) => {
    console.log('auth return url logic', req.params.token, JSON.stringify(req.body));

    let send_response = function(res, user) {
        try {
            return res.render(
                'send_to_parent.ejs',
                {user : user},
                function (e, r) {
                    try {
                        res.end(r);
                    }
                    catch(e) {}
                } 
            );
        }
        catch (err) {
             console.log(1312312321, err);
        }
    };

    send_response(res, {});
});
在send_to_parent.ejs中

<!DOCTYPE html>
<html>
<head>
     <title>#Sign in</title>

     <script type="text/javascript" src="https://appsforoffice.microsoft.com/lib/1.1/hosted/office.debug.js"></script>
     <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

    <script type="text/javascript">
         console.log('in ejs');

         function messageParent() {
              console.log('message parent');
              Office.context.ui.messageParent(true);
         }

         function openClick() {
              window.setTimeout(messageParent, 100);
         }

         Office.initialize = function (reason) {
             console.log('office initialize');
             $(document)
                .ready(function () {
                     console.log('jquery ready');
                     openClick();
                 });
          };
     </script>
 </head>
现在我终于有了展望。我也有Outlook.context,但没有用户界面。所以我不能执行messageParent

<head>
   <title>#Sign in</title>

   <script type="text/javascript" src="https://appsforoffice.microsoft.com/lib/1.1/hosted/office.debug.js"></script>
   <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

</head>
<body>
    <h1 style="text-align: center">Authorization Successful</h1>
    <div id="log">test</div>

    <script type="text/javascript">
       document.getElementById("log").innerText += "before initialize";
       Office.initialize = function () {
          document.getElementById("log").innerText += "initialized";
          $(document)
              .ready(function () {
                  document.getElementById("log").innerText += "jquery";

                  $("#closeButton").click(function () {
                    document.getElementById("log").innerText += "close clicked";
                    Office.context.ui.messageParent(true);
                });

                Office.context.ui.messageParent(true);
            });
      };

   </script>
</body>
function log(text) {
    document.getElementById("log").innerText += text;
}

function messageParent() {
    log('message parent');
    try {
        if ( !Office ) {
            log('no_office');
        }
        else if (!Office.context ) {
            log('no_context')
        }
        else if( !Office.context.ui) {
            log('no_ui');
        }
        else if (!Office.context.ui.messageParent) {
            log('no_message');
        }

        Office.context.ui.messageParent(true);
    }
    catch(e) {
        log("error");
        log(e);
    }
}

log("here");
Office.onReady ( function (reason) {
    log('office initialize');
    $(document)
        .ready(function () {
            log('jquery ready');
            // messageParent();

            $("#closeButton").click(function () {
                log(" close_clicked_out_of_office ");
                debugger
                messageParent();
            });
        });
});