recently i found this webpage: https://medium.com/@python-javascript-php-html-css/outlook-add-ins-retrieving-the-original-email-address-fb117202791c
There is an interesting code-snippet:
Office.onReady(() => {
// Ensure the environment is Outlook before proceeding
if (Office.context.mailbox.item) {
Office.context.mailbox.item.onMessageCompose.addAsync((eventArgs) => {
const item = eventArgs.item;
// Get the itemId of the original message
item.getInitializationContextAsync((result) => {
if (result.status === Office.AsyncResultStatus.Succeeded) {
console.log('Original Item ID:', result.value.itemId);
} else {
console.error('Error fetching original item ID:', result.error);
}
});
});
}
});