mspiess
Jun 29, 2022Brass Contributor
Status:
New
Allow .msg file export through JS add-in API in Outlook-Desktop
I'd like to create an add-in which create a .msg file of an email and sends it to a remote server for archival purposes. Outlook already can create .msg files through the "Save as..." dialog but thi...
Rich-E
Sep 12, 2023Copper Contributor
Alrighty Jim_Neill Philbewan here you go:
https://gist.github.com/DevDuck/db4e7e5903d5d3d2d49a238871da4311
Call it this way:
try {
await getEmailContentAsync({}, async (asyncResult: Office.AsyncResult<string>) => {
if (asyncResult.status != Office.AsyncResultStatus.Succeeded) {
// handle error
return;
}
let content = asyncResult.value;
// upload file
// Buffer.from(content, "utf8");
};
}
catch (err) {
// handle exception
}
It's a bit messy but should work. Please let me know if you have any issues with it. I know of one sporadic issue with the Mail app opening the files but Outlook seems to open them fine.