Berend Engelbrecht
Apr 09, 2025Brass Contributor
Status:
New
Implement Office.context.mailbox.item.getAsFileAsync for draft messages
We have a requirement in an Office.js add-in to do the following: Automatically send a message Save the sent message The functionality was previously implemented using EWS and Office.context.mai...
bondo
Nov 27, 2026Copper Contributor
Same need from an add-in that archives mail to a document/project system.
We file a user's replies in the project their thread belongs to. Today that only works after the user opens the sent copy in Sent Items, because getAsFileAsync is read mode only and there is no event after send. With getAsFileAsync in compose (for example inside OnMessageSend, or right before sendAsync) the add-in could file the exact MIME of the reply at send time, inline images as cid: parts, without Graph or EWS.
One detail that matters for this: please return the internetMessageId that the message will carry when it is sent, or document whether it can change at send. Several issues report a change between draft and sent; two (#2659, #1244) carry a product-bug label, but Microsoft has not confirmed the cause or fixed it (in #1244 it could not reproduce it). Is that expected?
- office-js #6066 (classic Outlook on Windows): https://github.com/OfficeDev/office-js/issues/6066
- office-js #2659 (classic Outlook on Windows): https://github.com/OfficeDev/office-js/issues/2659
- office-js #1244 (Outlook on Mac): https://github.com/OfficeDev/office-js/issues/1244
The event after send that this pairs with is requested in the idea "Outlook add-ins: event after a message is sent, with the sent item's internetMessageId and itemId":
- https://techcommunity.microsoft.com/idea/microsoft365developerplatform/outlook-add-ins-event-after-a-message-is-sent-with-the-sent-items-internetmessag/4577403
Related: the request to get the Message-ID of a sent message, the idea "Retrieve RFC message ID after sending the email" and office-js #5528:
- https://techcommunity.microsoft.com/idea/microsoft365developerplatform/retrieve-rfc-message-id-after-sending-the-email/4410862
- https://github.com/OfficeDev/office-js/issues/5528
(Drafted with the help of an AI assistant.)