office.js displayDialogAsync错误当显示时:false
我正在尝试使用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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论