我们有一个带有在清单中定义的功能区按钮的 Outlook Web 插件。
<Control xsi:type="Button" id="msgComposeSettingsButton">
<Label resid="funcComposeButtonLabel2" />
<Supertip>
<Title resid="funcComposeSuperTipTitle2" />
<Description resid="funcComposeSuperTipDescription2" />
</Supertip>
<Icon>
<bt:Image size="16" resid="settings-16" />
<bt:Image size="32" resid="settings-32" />
<bt:Image size="80" resid="settings-80" />
</Icon>
<Action xsi:type="ExecuteFunction">
<FunctionName>loadSettings</FunctionName>
</Action>
</Control>
loadSettings 函数在函数文件中定义,该函数文件也在清单中定义。loadSettings 函数从 Office Api 调用 displayDialogAsync 方法。
Office.context.ui.displayDialogAsync(
options.url,
options.dialogOptions,
function (asyncResult) {
if (asyncResult.status === Office.AsyncResultStatus.Failed) {
let errorMessage = null;
log('ERROR', asyncResult.error);
// In addition to general system errors, there are 3 specific errors for
// displayDialogAsync that you can handle individually.
switch (asyncResult.error.code) {
case 12004:
errorMessage = 'Domain is not trusted';
break;
case 12005:
errorMessage = 'HTTPS is required';
break;
case 12007:
errorMessage = 'A dialog is already opened.';
break;
default:
errorMessage = asyncResult.error.message;
break;
}
log('ERROR', errorMessage);
}
else {
_dialog = asyncResult.value;
_dialog.addEventHandler(Office.EventType.DialogMessageReceived, handleDialogMessageEvent);
_dialog.addEventHandler(Office.EventType.DialogEventReceived, eventReceivedHandler);
}
}
);
该对话框在每个测试平台(Outlook for Windows 和 OWA(IE、Firefox、Chrome))中呈现和打开都很好,除了 Outlook for Mac 上的少数几个。为什么该对话框在 Outlook for Mac 上对大多数人来说都按预期工作,但对少数人来说却不是?