I'm creating an add-in on Outlook on the Web, and I'm seeing unexpected behavior when I test it.
Details are described below.
Click "New message" on the Outlook on the web.
Click "Open in new window".
Wait about 10 minutes on the "new window".
Compose an email. and Click the "Send" button.
The process does not proceed and I cannot send an email.
After about 3 minutes, the following error message is displayed.
"We're sorry, we couldn't access "add-in Name". Make sure you have a network connection. If the problem continues, please try again later."
Probability and time of occurrence are irregular.
Please tell me how to solve this problem.
[2022.04.08]
index.js
/*
* Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
* See LICENSE in the project root for license information.
*/
var mailboxItem;
Office.initialize = function (reason) {
mailboxItem = Office.context.mailbox.item;
}
// Entry point for Contoso Message Body Checker add-in before send is allowed.
// <param name="event">MessageSend event is automatically passed by BlockOnSend code to the function specified in the manifest.</param>
function validateBody(event) {
Office.context.ui.displayDialogAsync(
"https://localhost:3000/index.html",
{
height: 65,
width: 40,
displayInIframe: true,
asyncContext: event,
},
(asyncResult) => {
asyncResult.value.addEventHandler(Office.EventType.DialogEventReceived,
(processMessage) => {
asyncResult.value.close()
asyncResult.asyncContext.completed({ allowEvent: false })
}
)
}
)
}
popup.html
<!DOCTYPE html>
<html lang="ja">
<head>
<title>test</title>
<meta http-equiv="content-type" charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type="text/javascript" src="https://appsforoffice.microsoft.com/lib/1.1/hosted/office.js"></script>
</head>
<body>
test
</body>
</html>
Looks like you specified the
ItemSendevent in the manifest file and your add-in can't be located or reached. Or the event handler specified in the manifest isn't publicly available.