I'm using the 1.3 requirement set for setting/getting the body value of an appointment/meeting: Office.context.mailbox.item.body.getAsync(...)
and Office.context.mailbox.item.body.setAsync(...)
This works just fine literally everywhere and for all account types(Exchange on-premise and Outlook/Office365 accounts) except Outlook 2016 for MAC, where it fails to apply the html/text value of the body.
Checking the requirement sets (https://dev.office.com/reference/add-ins/outlook/tutorial-api-requirement-sets) MAC Outlook is listed as supporting all the requirement set versions(1.1 to 1.5) so it should support also the getAsync and setAsync methods for body property.
Any idea why it does not work?
UPDATE:
For setting value:
function applyBody() {
const $dBod = $.Deferred();
try {
Office.context.mailbox.item.body.setAsync(_appointmentInfo.body.value, { coercionType: _appointmentInfo.body.type }, function (asyncResult) {
if (asyncResult.status === Office.AsyncResultStatus.Succeeded) {
$dBod.resolve();
}
else {
$dBod.reject(translate.getTranslation('ERROR_SETTING_BODY'));
}
});
}
catch (e) {
$dBod.reject(e);
}
return $dBod.promise();
}
For getting value:
function getBody() {
const $dBod = $.Deferred();
getBodyType()
.done(function (bodyType) {
try {
Office.context.mailbox.item.body.getAsync(bodyType, function (asyncResult) {
if (asyncResult.status === Office.AsyncResultStatus.Succeeded) {
$dBod.resolve({ value: asyncResult.value, type: bodyType });
}
else {
$dBod.reject(translate.getTranslation('ERROR_GETTING_BODY_VALUE'));
}
});
}
catch (e) {
$dBod.reject(e);
}
})
.fail($dBod.reject);
return $dBod.promise();
}
For getting body type:
function getBodyType() {
const $dBod = $.Deferred();
try {
Office.context.mailbox.item.body.getTypeAsync(function (asyncResult) {
if (asyncResult.status === Office.AsyncResultStatus.Succeeded) {
$dBod.resolve(asyncResult.value);
}
else {
$dBod.reject(translate.getTranslation('ERROR_GETTING_BODY_TYPE'));
}
});
}
catch (e) {
$dBod.reject(e);
}
return $dBod.promise();
}
UPDATE2:
Method I use for concatenating initial body value with my html:
const filterNullsAndUndefined = function (array, char) {
return array.filter(function (val) { return val; }).join(char);
};
I call it like this filterNullsAndUndefined([intialBodyValue, myHtml],'');
Where in my case the initialBodyValue is the value I get using body.getAsync(...)
before appending myHtml to it( in order to preserve any text the user inserted before myHtml template gets appended).
If I set myHtml directly on the body (overwrite) it works.
UPDATE 3:
Below the result we got when we appended the word 'Christmass':