office.js displayDialogAsync错误当显示时:false

发布于 2025-01-28 15:16:09 字数 1469 浏览 3 评论 0原文

我正在尝试使用displayDialogAsync函数在Outlook Web加载项中显示来自Taskpane的对话框。首先,我使用displayIniframe:true,一切都很好,但是由于某些原因,我需要它在自己的页面中显示。

因此,我将选项更改为displayIniframe:false,这会导致提示打开。打开并单击允许时,我会得到json.parser错误。

在json.parse(< anonymous>)位置的JSON中的意外令牌D(o(outlook-web-16.01.js:20:204476)在htmlinputelement.yfonclick.yfonclick(Outlook-web-16.01)。 JS:20:196995)

它是从这行开始的:var windowname = json.parse(window.name);

我尝试使用strign> stright> striptbebeopen关闭提示代码>,但正如它在 docs ,“当此选项设置为false时,网络上的办公室将不会提示用户允许加载项打开对话框,并且办公室对话框将无法打开。”

我想知道我是否缺少某些东西,或者您是否实际上无法在任务台上的iframe之外打开对话框?

这是我的代码:

const dialogUrl = "https://office365.localhost.com/test.html";
Office.context.ui.displayDialogAsync(
                       dialogUrl, 
                       { 
                            displayInIframe: false,
                            height: 80,
                            width: 80
                        }, 
                       (result) => {
                            //Code
                        
                       }
                });

更新 带有displayIniframe的显示对话框:false现在与最后一个Microsoft Update一起使用

I'm trying to display, in an outlook web add-in, a dialog from a taskpane using the displayDialogAsync function. At first, I used displayInIframe: true and everything was working wonderfully, but for some reason I needed it to display in its own page.

So I changed the options to displayInIframe: false, and that causes a prompt to open. When it opens and I click Allow, I get a JSON.parser error.

Uncaught SyntaxError: Unexpected token d in JSON at position 0 at JSON.parse (<anonymous>) at O (outlook-web-16.01.js:20:204476) at HTMLInputElement.Y.f.onclick (outlook-web-16.01.js:20:196995)

It's comming from this line: var windowName = JSON.parse(window.name);

I tried turning the prompt off using promptBeforeOpen: false, but as it says in the docs, "When this option is set to false, Office on the web will not prompt the user to allow the add-in open a dialog, and the Office dialog will not open."

I was wondering if I was missing something, or if you can't actually open a dialog outside of an iframe in a taskpane?

Here is my code:

const dialogUrl = "https://office365.localhost.com/test.html";
Office.context.ui.displayDialogAsync(
                       dialogUrl, 
                       { 
                            displayInIframe: false,
                            height: 80,
                            width: 80
                        }, 
                       (result) => {
                            //Code
                        
                       }
                });

Update
Display dialog with displayInIframe: false now works with the last microsoft update

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文