Your Environment
- Platform: PC desktop (Classic Outlook for Windows)
- Host: Outlook
- Office version number: 16.0.20131.20090
- Operating System: Windows 11 Pro
- Browser: N/A
Expected behavior
When an OnMessageSend handler calls
Office.context.mailbox.item.internetHeaders.setAsync({ "x-some-header": "true" })
and the callback reports AsyncResultStatus.Succeeded, the header is
present on the delivered message.
Current behavior
When the item being sent is a calendar-invite forward originated from
the Calendar view (right-click event → Forward), the header is absent
from the delivered .eml, despite:
setAsync callback returning Succeeded
- a follow-up
getAsync in the same handler returning the value
The same handler code works correctly for new mail.
Steps to reproduce
- Switch to Calendar.
- Right-click an existing event → Forward.
- Address it to a mailbox you control and click Send.
- Inspect the delivered message's internet headers -
x-min-repro-checked
is missing.
Handler code:
var TAG = "[MIN-REPRO]";
var HEADER_NAME = "x-min-repro-checked";
console.log(TAG, "runtime script loaded");
console.log(TAG, "typeof Office =", typeof Office);
console.log(TAG, "typeof Office.actions =", typeof Office !== "undefined" && typeof Office.actions);
try {
Office.actions.associate("onMessageSendHandler", onMessageSendHandler);
console.log(TAG, "associate('onMessageSendHandler', ...) returned");
} catch (e) {
console.log(TAG, "associate threw:", e && e.message);
}
function onMessageSendHandler(event) {
console.log(TAG, "onMessageSendHandler invoked");
var item = Office.context.mailbox.item;
console.log(TAG, "setAsync", HEADER_NAME, "= true");
var headersToSet = {};
headersToSet[HEADER_NAME] = "true";
item.internetHeaders.setAsync(headersToSet, function (setResult) {
console.log(TAG, "setAsync status =", setResult.status);
if (setResult.error) {
console.log(TAG, "setAsync error", setResult.error.code, setResult.error.message);
}
console.log(TAG, "verify with getAsync");
item.internetHeaders.getAsync([HEADER_NAME], function (getResult) {
console.log(TAG, "getAsync status =", getResult.status);
console.log(TAG, "getAsync value =", JSON.stringify(getResult.value));
console.log(TAG, "event.completed allowEvent=true");
event.completed({ allowEvent: true });
});
});
}
The handler does only:
internetHeaders.setAsync({ "x-min-repro-checked": "true" })
internetHeaders.getAsync(["x-min-repro-checked"]) to verify
event.completed({ allowEvent: true })
Useful logs
Runtime trace from the failing path:
'[MIN-REPRO]', 'onMessageSendHandler invoked'
'[MIN-REPRO]', 'setAsync', 'x-min-repro-checked', '= true'
'[MIN-REPRO]', 'setAsync status =', 'succeeded'
'[MIN-REPRO]', 'verify with getAsync'
'[MIN-REPRO]', 'getAsync status =', 'succeeded'
'[MIN-REPRO]', 'getAsync value =', '{"x-min-repro-checked":"true"}'
'[MIN-REPRO]', 'event.completed allowEvent=true'
Additionally, we noticed that the item type was reported as MESSAGE, not APPOINTMENT. Is this expected?
Your Environment
Expected behavior
When an
OnMessageSendhandler callsOffice.context.mailbox.item.internetHeaders.setAsync({ "x-some-header": "true" })and the callback reports
AsyncResultStatus.Succeeded, the header ispresent on the delivered message.
Current behavior
When the item being sent is a calendar-invite forward originated from
the Calendar view (right-click event → Forward), the header is absent
from the delivered
.eml, despite:setAsynccallback returningSucceededgetAsyncin the same handler returning the valueThe same handler code works correctly for new mail.
Steps to reproduce
x-min-repro-checkedis missing.
Handler code:
The handler does only:
internetHeaders.setAsync({ "x-min-repro-checked": "true" })internetHeaders.getAsync(["x-min-repro-checked"])to verifyevent.completed({ allowEvent: true })Useful logs
Runtime trace from the failing path:
Additionally, we noticed that the item type was reported as
MESSAGE, notAPPOINTMENT. Is this expected?