I created an Office add-in, and I'm wondering how to get the Internet headers using getAllInternetHeadersAsync? I have the below code, which will send the headers to the console:
var headers = "";
// Get the internet headers related to the mail.
Office.context.mailbox.item.getAllInternetHeadersAsync(
function(asyncResult) {
if (asyncResult.status === Office.AsyncResultStatus.Succeeded) {
headers = asyncResult.value;
console.log(headers);
} else {
if (asyncResult.error.code == 9020) {
// GenericResponseError returned when there is no context.
// Treat as no context.
} else {
// Handle the error.
}
}
}
);
console.log("headers = " + headers);
However, headers doesn't seem to get permanently set. The first console.log shows the correct value for headers. The last console.log, however, reveals that headers is back to empty. How can I get headers set so that after the getAllInternetHeadersAsync function I can still see it?
Thanks!