带有Exchange 2013帐户的Outlook Web App的Office.context.ui不受保护 [英] Office.context.ui undefiend for Outlook Web App with Exchange 2013 account

查看:116
本文介绍了带有Exchange 2013帐户的Outlook Web App的Office.context.ui不受保护的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要Exchange 2013帐户支持的Outlook Web加载项.因此,在为Outlook Web App添加清单文件后,加载项加载良好.

I need outlook web add-in supported for Exchange 2013 accounts. So after adding manifest file for Outlook web app The add-in is loading nicely.

我正在使用Dialog API弹出窗口来实现登录功能.因此,当客户单击登录按钮时,它会显示Cannot read property 'displayDialogAsync' of undefined

I am using Dialog API popup for Sign In functionality. So when customer is clicking on sign in button it shows Cannot read property 'displayDialogAsync' of undefined

调试时,我知道 Office.context 不包含 ui 属性.

while debugging I came to know that Office.context does not contain ui property.

任何人都可以指导我哪里出问题了吗?或包含交换帐户的Outlook Web App是否支持此Dialog API.

Can anyone guide where I am going wrong ? Or Is this Dialog API supported for Outlook web app containing exchange accounts.

我的加载项在Outlook Desktop,Outlook Web和 也可以移动

My add-in is working nicely for Outlook Desktop, Outlook Web and mobile as well

if (window.hasOwnProperty('Office')) {
      Office.context.ui.displayDialogAsync(
        `${window.location.origin}/#/signin/` + Office.context.mailbox.userProfile.emailAddress,
        {
          height: 60,
          width: 20
        },
        (result) => {
          const dialog = result.value;
          dialog.addEventHandler(
            Office.EventType.DialogMessageReceived,
            (e: { type: string, message: string }) => {
              if (e.message === 'true') {
                this.oAuthService.initImplicitFlow();
              }
              dialog.close();
            });
        }
      );
      }

推荐答案

您需要检查需求集.

需求集是API成员的命名组. Office加载项使用清单中指定的要求集或使用运行时检查来确定Office主机是否支持加载项所需的API.有关更多信息,请参见Office版本和要求集. displayDialogAsync 方法可用于Word,Excel或PowerPoint加载项的DialogApi要求集中以及邮箱要求中.为Outlook设置1.4.

You need to check the requirements set.

Requirement sets are named groups of API members. Office Add-ins use requirement sets specified in the manifest or uses a runtime check to determine whether an Office host supports APIs that an add-in needs. For more information, see Office versions and requirement sets. The displayDialogAsync method is available in the DialogApi requirement set for Word, Excel, or PowerPoint add-ins, and in the Mailbox requirement set 1.4 for Outlook.

请参见

See Dialog API requirement sets for more information about requirements for the Dialog API.

您的回调需要检查result.error.coderesult.error.message.一旦知道了错误所在,就可以开始故障排除.例如.

Your callback needs to check result.error.code and result.error.message. Once you know what the error is, you can start troubleshooting. For example.

var dialog;
Office.context.ui.displayDialogAsync('https://myDomain/myDialog.html',
   function (asyncResult) {
       if (asyncResult.status === Office.AsyncResultStatus.Failed) {
            showNotification(asyncResult.error.code = ": " + asyncResult.error.message);
       } else {
            dialog = asyncResult.value;
            dialog.addEventHandler(Office.EventType.DialogMessageReceived, processMessage);
      }
});

这篇关于带有Exchange 2013帐户的Outlook Web App的Office.context.ui不受保护的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆