diff --git a/src/addons/outlook/src/commands/commands.js b/src/addons/outlook/src/commands/commands.js
index e5e7128c..d369431b 100644
--- a/src/addons/outlook/src/commands/commands.js
+++ b/src/addons/outlook/src/commands/commands.js
@@ -24,19 +24,21 @@ function notify(message) {
function insertMeetingLink(event, session) {
createRoom(session)
.then((data) => {
- const { url, message } = buildMeetingMessage(data);
+ const isWeb = Office.context.diagnostics.platform === "OfficeOnline";
+ const { url, text } = buildMeetingMessage(data, isWeb);
const item = Office.context.mailbox.item;
+ const coercionType = isWeb ? Office.CoercionType.Html : Office.CoercionType.Text;
return new Promise((resolve, reject) => {
- item.body.getAsync(Office.CoercionType.Html, (getResult) => {
+ item.body.getAsync(coercionType, (getResult) => {
if (getResult.status !== Office.AsyncResultStatus.Succeeded) {
notify(`Erreur de lecture : ${getResult.error.message}`);
resolve();
return;
}
-
- const newBody = getResult.value + message;
- item.body.setAsync(newBody, { coercionType: Office.CoercionType.Html }, (setResult) => {
+ item.body.setAsync(
+ getResult.value + text,
+ { coercionType: coercionType }, (setResult) => {
if (setResult.status !== Office.AsyncResultStatus.Succeeded) {
notify(`Erreur d'insertion : ${setResult.error.message}`);
resolve();
diff --git a/src/addons/outlook/src/common/messageBuilder.js b/src/addons/outlook/src/common/messageBuilder.js
index b50e3fb0..f29184c2 100644
--- a/src/addons/outlook/src/common/messageBuilder.js
+++ b/src/addons/outlook/src/common/messageBuilder.js
@@ -21,7 +21,7 @@ function _formatPhone(phone) {
}
// todo - escape html / link
-function buildMeetingMessage(data) {
+function buildMeetingMessage(data, isWeb) {
if (!data?.url) {
throw new Error("buildMeetingMessage: missing url in data");
}
@@ -30,23 +30,45 @@ function buildMeetingMessage(data) {
const phone = _formatPhone(data.telephony?.phone_number);
const pin = _formatPin(data.telephony?.pin_code);
- const telephonyBlock =
- phone && pin
- ? `
+ let textLines = "";
+ let phoneLines = [];
-Ou appelez (audio uniquement)
-(FR) ${phone}
-Code : ${pin}`
- : "";
+ phoneLines = phone &&
+ pin && [
+ "
Ou appelez (audio uniquement)",
+ `
(FR) ${phone}`,
+ `
Code ${pin}`
+ ];
- const message = `
-────────────────────────────────────────
-Rejoindre la réunion ${APP_NAME}
+ textLines = [
+ "
────────────────────────────────────────",
+ `
Rejoindre la réunion ${APP_NAME}`,
+ `
${url}`,
+ ...phoneLines,
+ "
────────────────────────────────────────
",
+ ];
-${url}${telephonyBlock}
-────────────────────────────────────────`;
+ } else {
- return { url, message };
+ phoneLines = phone &&
+ pin && [
+ "\n\nOu appelez (audio uniquement)",
+ `\n(FR) ${phone}`,
+ `\nCode ${pin}`
+ ];
+
+ textLines = [
+ "\n\n────────────────────────────────────────",
+ `\nRejoindre la réunion ${APP_NAME}`,
+ `\n\n${url}`,
+ ...phoneLines,
+ "\n────────────────────────────────────────\n",
+ ];
+ }
+
+ const text = textLines.join("");
+
+ return { url, text };
}
module.exports = { buildMeetingMessage };
diff --git a/src/addons/outlook/src/taskpane/taskpane.js b/src/addons/outlook/src/taskpane/taskpane.js
index 9ed3768a..a0541e51 100644
--- a/src/addons/outlook/src/taskpane/taskpane.js
+++ b/src/addons/outlook/src/taskpane/taskpane.js
@@ -71,18 +71,20 @@ function generateMeetingLink() {
createRoom(session)
.then((data) => {
- const { url, message } = buildMeetingMessage(data);
+ const isWeb = Office.context.diagnostics.platform === "OfficeOnline";
+ const { url, text } = buildMeetingMessage(data, isWeb);
const item = Office.context.mailbox.item;
+ const coercionType = isWeb ? Office.CoercionType.Html : Office.CoercionType.Text;
+
return new Promise((resolve, reject) => {
- item.body.getAsync(Office.CoercionType.Html, (getResult) => {
+ item.body.getAsync(coercionType, (getResult) => {
if (getResult.status !== Office.AsyncResultStatus.Succeeded) {
reject(getResult.error);
return;
}
-
item.body.setAsync(
- getResult.value + message,
- { coercionType: Office.CoercionType.Html },
+ getResult.value + text,
+ { coercionType: coercionType },
(setResult) => {
if (setResult.status !== Office.AsyncResultStatus.Succeeded) {
reject(setResult.error);