Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OnSend fired twice after attachment reminder

In Outlook Web Add-In, I'm trying to intercept OnSend event which is triggered when sending an email.

I used this example in GitHub which is working fine.

If I include the word "attachment" in the email body and I click Send button, OnSend event is fired once and a pop-up modal window shows up with this message:

Attachment reminder

You may have forgotten to attach a file.

with Send and Don't send buttons. If click Send, OnSend event get fired twice: 2 times after clicking Send button within attachment reminder. I was expecting only one event like the first Send.

How can I make OnSend event fire once after the attachment reminder?

like image 374
Mhd Avatar asked Aug 03 '17 15:08

Mhd


2 Answers

This appears to be unintentional behavior, essentially a defect that we will look into fixing. ItemSend event should inter operate with forgotten attachment detection nicely, and should only be raised once for any email and only after the forgotten attachment detection happened. In the mean time, you'll need to come up with a workaround. Depending on what you're trying to do, you may be able to use custom properties API to set a property indicating that message has been processed already to avoid duplicate processing.

like image 192
Outlook Add-ins Team - MSFT Avatar answered Nov 17 '22 09:11

Outlook Add-ins Team - MSFT


You can't - if the message submission is canceled and the message is then resubmitted, the event is fired again. You can have a list of message entry ids that you processed - add the id to that list when OnSend fires, then check if the message is in that list when the event fires again next time.

like image 20
Dmitry Streblechenko Avatar answered Nov 17 '22 11:11

Dmitry Streblechenko