我们有一个Outlook网络插件,其清单中定义了功能区按钮。
<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上大多数情况下都能正常工作,但对于少数人来说却没有?