70 lines
2.1 KiB
JavaScript
70 lines
2.1 KiB
JavaScript
/*
|
|
* Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
* See LICENSE in the project root for license information.
|
|
*/
|
|
|
|
/* global global, Office, self, window, Word */
|
|
|
|
Office.onReady((data) => {
|
|
// If needed, Office.js is ready to be called
|
|
});
|
|
|
|
/**
|
|
* Shows a notification when the add-in command is executed.
|
|
* @param event {Office.AddinCommands.Event}
|
|
*/
|
|
function showNotification(event) {
|
|
const message = {
|
|
type: Office.MailboxEnums.ItemNotificationMessageType.InformationalMessage,
|
|
message: "Base command executed",
|
|
icon: "Icon.80x80",
|
|
persistent: false
|
|
};
|
|
|
|
// Show a notification message
|
|
Office.context.mailbox.item.notificationMessages.replaceAsync("action", message);
|
|
event.completed();
|
|
}
|
|
|
|
|
|
async function writeInviteIta(event) {
|
|
|
|
Office.context.mailbox.item.body.setSelectedDataAsync(
|
|
"<br/><a href=\"https://portal.pal.it/General/VisitorRegistration\">Registrati come visitatore per agevolare il tuo ingresso in PAL s.r.l.</a><br/>",
|
|
{
|
|
coercionType: "html",
|
|
},
|
|
|
|
// Callback method to check that setAsync succeeded
|
|
function (asyncResult) {
|
|
if (asyncResult.status ==
|
|
Office.AsyncResultStatus.Failed) {
|
|
write(asyncResult.error.message);
|
|
}
|
|
}
|
|
);
|
|
|
|
event.completed();
|
|
}
|
|
|
|
async function writeInviteEng(event) {
|
|
Office.context.mailbox.item.body.setSelectedDataAsync(
|
|
"<br/><a href=\"https://portal.pal.it/General/VisitorRegistration\">Register as a visitor to facilitate your entry into PAL s.r.l.</a><br/>",
|
|
{
|
|
coercionType: "html",
|
|
},
|
|
|
|
// Callback method to check that setAsync succeeded
|
|
function (asyncResult) {
|
|
if (asyncResult.status ==
|
|
Office.AsyncResultStatus.Failed) {
|
|
write(asyncResult.error.message);
|
|
}
|
|
}
|
|
);
|
|
|
|
event.completed();
|
|
}
|
|
|
|
Office.actions.associate("writeInviteIta", writeInviteIta);
|
|
Office.actions.associate("writeInviteEng", writeInviteEng); |