Handling of mails sent from draft

Add-in Express™ Support Service
That's what is more important than anything else

Handling of mails sent from draft
 
Ishaat Zahidi


Guest


We cancel the send mail user operation in ProcessSend outlook event and instead handle the mail in SendMessage event. This works fine for any new mails sent. However, in certain scenario, where user creates a mail and saves it to draft. Then when the mail is sent from draft the above mechanism breaks with following exception when attempting to send mail in OnSendMessage method:

2018-08-16 22:11:01,131 ERROR [VSTA_Main] FilrOutlookAddIn.OutlookItemEventsClass.AddinModule_OnSendMessage - Exception: Failed to send the mail: System.Runtime.InteropServices.COMException (0x80004005): This method can't be used with an inline response mail item.
at Microsoft.Office.Interop.Outlook._MailItem.Send()
at FilrOutlookAddIn.OutlookItemEventsClass.AddinModule_OnSendMessage(Object sender, ADXSendMessageEventArgs e)

What am I missing?

Thanks.
Posted 02 Sep, 2018 02:22:50 Top
Andrei Smolin


Add-in Express team


Posts: 18825
Joined: 2006-05-11
Hello Ishaat,

You get the https://docs.microsoft.com/en-us/office/vba/api/outlook.explorer.inlineresponse event when you open an email in an inline response. The email opened in an inline response can't be sent using MailItem.Send; that's by Outlook design. Save the inline response and get its EntryId. Close the inline response by clearing the selection; see https://docs.microsoft.com/en-us/office/vba/api/outlook.explorer.clearselection. Note that you get the https://docs.microsoft.com/en-us/office/vba/api/outlook.explorer.inlineresponseclose event when the inline response gets closed.

When the inline response is closed, get the item using Namespace.GetItemFromId and send it.


Andrei Smolin
Add-in Express Team Leader
Posted 03 Sep, 2018 03:35:44 Top
Ishaat Zahidi


Guest


How is Explorer.InlineResponseClose event tied to item send event? Is "Explorer.InlineResponseClose" event fired only after user hits send button? I assume this event can't be used to send the mail.
Posted 04 Sep, 2018 02:49:37 Top
Andrei Smolin


Add-in Express team


Posts: 18825
Joined: 2006-05-11
You are probably right. That event can be useful in a different scenario(s).


Andrei Smolin
Add-in Express Team Leader
Posted 04 Sep, 2018 03:47:26 Top