Old UI on latest outlook on Windows breaks if LaunchEvent (OnMessageSend) event has Promise

Copper Contributor

Create a manifest having ExtensionPoint as LaunchEvent with Type as OnMessageSend.

 

<ExtensionPoint xsi:type="LaunchEvent">
<LaunchEvents>
<LaunchEvent Type="OnMessageSend" FunctionName="onMessageSendHandler" SendMode="PromptUser" />
</LaunchEvents>
<SourceLocation resid="WebViewRuntime.Url"/>
</ExtensionPoint>

 

 Now write any code in LaunchEvent.js which uses Promise (below code is one such example). 

 

const senderEmail = new Promise((resolve) => {
     Office.context.mailbox.item.from.getAsync((response) => {
       resolve(response.value);
     });
   });

const onMessageSendHandler = (event: Office.AddinCommands.Event) => {
    await senderEmail();
}

 

 It seems, on OnMessageSend event the script won't compile. This is even true if Promise code is dangling and not used by any function. The same code works on new UI on the same outlook app.

0 Replies