Outlook VSTO Send ActiveInlineResponse E-Mail

asked 2021-10-15T13:09:33.53+00:00
Marc Henderkes 1 Reputation point

As documented in https://learn.microsoft.com/de-de/office/vba/api/Outlook.explorer.activeinlineresponse, sending a MailItem that is currently open in the inline response editor is not possible for whatever reason (could anyone please share the reason for this stupid design decision? you can send it manually, after all?).

Now, I'm attempting to write a plugin that sends all selected drafts. This works fine, except for the item currently open in the inline response pane. The way to close this inline response pane as recommended by Microsoft is to call MailItem.Display(). However, even after calling MailItem.Display() in the add-in, attempting to call MailItem.Send() right after, will still result in the same COMException that inline responses cannot be sent. This will be the case no matter how long I wait, until the button_click event has returned. Creating a thread to send the message after causes Outlook to crash.

So - how on earth does one programmatically send the active element? Trigger the send button as a user would? According to previous answers, not possible. Surely the answer can't be "tell the user to manually send that current element"?

Alternatively, any way to close the ActiveInlineResponse immediately so that it is possible to call Send() after? Having the current mail pop up as it's own window with MailItem.Display() would be rather annoying to the user (if it worked, but it doesn't anyway, because it doesn't close it immediately).

Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
1,932 questions
Outlook Management
Outlook Management
Outlook: A family of Microsoft email and calendar products.Management: The act or process of organizing, handling, directing or controlling something.
3,415 questions
No comments
{count} votes