I'm trying to develop an Outlook Add-In that allows to extract headers from a selected email and print them in a new email.
For that need, I used the following method to create a new email that includes, as an attachment, the selected email:
Office.context.mailbox.displayNewMessageForm({
toRecipients: ["[email protected]"],
subject: mailSubject,
htmlBody: mailBody,
attachments: [{ type: "item", itemId: Office.context.mailbox.item.itemId, name: Office.context.mailbox.item.subject }]
});
I looked at the following method to get the headers from the selected email:
Office.context.mailbox.item.getAllInternetHeadersAsync(
function (asyncResult) {
if (asyncResult.status === Office.AsyncResultStatus.Succeeded) {
headers = asyncResult.value; // get the headers
}
}
);
(Un)fortunately, this method is asynchronous and I get the headers after the creation of the new email (displayNewMessageForm). My goal is to write these headers in the parameter htmlBody used for the creation of the new email.
I tried to used the async method for the email creation (displayNewMessageFormAsync), without success.
If possible, I want to get the headers (asynchronously) and pass them as a parameter of the displayNewMessageForm() method or update the created email to add the headers (if possible again).
I'm looking for your help!
question from:
https://stackoverflow.com/questions/65626223/how-to-write-extracted-email-headers-in-a-new-email 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…