-
Notifications
You must be signed in to change notification settings - Fork 117
Description
Provide required information needed to triage your issue
In New Outlook for Windows & OWA, it seems if you remove an internetHeader using the Office JS API, you are unable to add the header back. This is not the case in Classic Outlook for Windows or Mac.
Some of our workflows with our Smart Alerts OnMessageSend Add-in require us to remove stale headers at the start of a new send event, and potentially add them back before we allow the email to be sent. This bug breaks that flow.
Your Environment
- Platform [PC desktop, Mac, iOS, Office on the web]: OWA & PC
- Host [Excel, Word, PowerPoint, etc.]: New Outlook for Windows & OWA
- Office version number: New Outlook for Windows
- Operating System: Windows 11 Pro 64-bit (10.0, Build 26100)
- Browser (if using Office on the web): Chrome Version 143.0.7499.170 (Official Build) (arm64)
Expected behavior
I would expect headers removed with the internet headers api to be able to be added back to the email without restriction.
Current behavior
If you remove a header from the email, you cannot add it back. The add header API doesn't fail or anything, it just silently does not add the header back.
Steps to reproduce
- Add a header to an email using the internet headers api
- Remove the same header
- Try adding it back again
- Send the email and note the header is not on the email
Link to live example(s)
This code snippet replicates the issue
export const setInternetHeaderPropertyAsync = (headers: Record<string, string>): Promise<void> => {
return new Promise<void>((resolve, reject) => {
Office.context.mailbox.item?.internetHeaders.setAsync(headers, (asyncResult: Office.AsyncResult<void>) => {
if (asyncResult.status === Office.AsyncResultStatus.Failed) {
reject(asyncResult.error);
} else {
resolve();
}
});
});
};
export const removeInternetHeadersAsync = (headers: string[]): Promise<void> => {
return new Promise<void>((resolve, reject) => {
Office.context.mailbox.item?.internetHeaders.removeAsync(headers, (asyncResult: Office.AsyncResult<void>) => {
if (asyncResult.status === Office.AsyncResultStatus.Failed) {
reject(asyncResult.error);
} else {
resolve();
}
});
});
};
const onMessageSendHandlerImpl = async (event: Office.MailboxEvent) => {
try {
await setInternetHeaderPropertyAsync({ ["x-test-header"]: "true" });
await removeInternetHeadersAsync(["x-test-header"]);
await setInternetHeaderPropertyAsync({ ["x-test-header"]: "true" });
} catch (e) {
// No errors are thrown
console.log(e);
} finally {
// Let email send and note that the header is not added to the email
event.completed({ allowEvent: true });
}
};Provide additional details
Context
Some of our workflows with our Smart Alerts OnMessageSend Add-in require us to remove stale headers at the start of a new send event, and potentially add them back before we allow the email to be sent. This bug breaks that flow.
Useful logs
- Console errors
- Screenshots
- Test file (if only happens on a particular file)
Thank you for taking the time to report an issue. Our triage team will respond to you in less than 72 hours. Normally, response time is <10 hours Monday through Friday. We do not triage on weekends.