Forum Discussion

vipul94's avatar
vipul94
Copper Contributor
Dec 27, 2023

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

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.

No RepliesBe the first to reply

Resources