OnSend fired twice after attachment reminder

被刻印的时光 ゝ 提交于 2019-12-10 02:52:19

问题


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?


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/45489188/onsend-fired-twice-after-attachment-reminder

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!