1
votes

I'm working on an Outlook plugin using the office js library. Part of the functionality of the application is to store emails in our cloud platform so they can be related to other data in the system. In order to make it a one step process we wanted to enable the user to send the email from within of our add-in. I managed to achieve this by calling the item.saveAsync method to save the item as a draft then from the REST API I can call messages/{itemId}/send which successfully sends the email after which I can send the details to our cloud platform. My only issue is that the Outlook UI (testing outlook.live.com right now) never updates. I'm hunting around the office js API for a way to trigger the UI to redraw / close the editor etc etc but i'm drawing a blank. Any help would be appreciated.

If I can't update the UI is there a better way to get the details of the email after it is sent? I know the SentItem handler is a possibility but it's my understanding that that is only used for add-ins with no UI and we need the context of the add-in to know what do do with the email information in our cloud platform.

1
You can show a dialog in an OnSend handler. But there is a time limit of 5(?) minutes that you need to take some action. And in the end Outlook will send the item itself unless you reject it. I don't think there is a way to tell Outlook the message has already been sent. If not, you can record a user-voice request for that feature here: officespdev.uservoice.com/forums/224641-general/category/…Brian Clink
If you are looking to just close the editor, you can use Office.context.mailbox.item.close(). Is there more you need for the scenario?Outlook Add-ins Team - MSFT
how on earth did i not see that method call in either the docs (it's there) or in intellisense?Justin Sunseri
i am just going to post Office.context.mailbox.item.close() as answer then. in case you are really wondering for intellisense, if you are using d.ts from github.com/OfficeDev/office-js, it might be missing there. Let us know.Outlook Add-ins Team - MSFT
Noticed something strange happening. After saving and sending and calling getItemIdAsync I get a Id with an the last couple chars always like this '...EqauWAAAA' but later when the user navigates to the item in outlook sent items folder the itemId that outlook js is giving me ends with '...Eqdp7AAAA' Why on earth is the id changing?Justin Sunseri

1 Answers

0
votes

There is no JS API to redraw/refresh the UI, however, Office.context.mailbox.item.close() can be used to close the editor.