Events not triggering when using Send To (Mail Recipient) - vba

I have an Outlook VBA form, which (on the initialize event) loads various data into menus.
This works in normal usage, however, if you right click, send to (mail recipient) on a file or Send > Email in Word, when you click the button to load the form, the form displays but nothing in any events trigger either on the form load, or on the various click events.
Can anyone offer an explanation of why and how to work around the issue?

You need to handle the NewInspector event of the Inspectors class.

Outlook inspectors shown using Simple MAPI or mailto link do not fire inspector events. This was done on purpose.
Which particular event are you using?

Related

Outlook Forms: Recipient does not receive form, only message body //How to store form's data in an email?

I am currently trying to create a form in Outlook. I want to be able to send this form to different people so that they can make changes to the form and send those changes back to me as a response.
I have a published form in the meantime. My current problem: The recipient does not see the form until he "undocks" the email from the Outlook app and the changes made there are not transmitted to me; I just get an empty form. How or where can I save this data that the recipients enter? I am grateful for any help!
The form definition includes all the fields and the code that you add to the form. As a general rule, publish the form definition to a forms library instead of sending the form definition with the item. If you cannot publish your form to a forms library, you can select the Send form definition with item check box on the Properties page so that other users can see the form pages when they receive items that are composed by using the form.
Forms that you only intend to use once and not publish are referred to as one-off forms. Because of security concerns with one-off forms, users might not see the form correctly when they open items sent to them with a one-off form. In this case, sending the form definition with the one-off form provides the necessary information required to display the form correctly for the users.
To change how users reply to your form, click the Actions page. The Actions page lists the default Reply forms that are available. You can also add your own custom Reply forms. For example, forms based on a new email message have built-in Reply, Reply to All, Forward, and Reply to Folder forms. When users receive your form, the form contains buttons and menu commands so that users can respond to the form. You can disable some or all of these default forms and set attributes that define how these Reply forms appear.
Read more about that in the Create an Outlook Form section of MSDN.

VSTO Outlook AddIn: How to handle event when AppointmentItem.Body changes

I tried to catch the event when the AppointmentItem.Body changes. Handling the PropertyChange on the AppointmentItem does not get called when I type in text or save the AppointmentItem. It gets called when I hit the button "Add Participants though".
Best would be to get the Keydown on the body editor?
The Outlook object model may not propagate changes made in the Outlook UI until you switch focus to another field and/or save the item. This is a well-known issue when dealing with the Outlook object model.

Intercept OnSend event 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 for the first time so I can do some processing to email's content. However, after a while, 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 gets fired a second time. This time, It would be useless to repeat the same email processing. So, I'm looking for a way to find out that the second OnSend event is fired after an Attachment reminder.
Is there a way to distinguish between first and second OnSend events?
Thanks for your question, Mhd! 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 after the detection happened. In other words, the first event should not be called at all. Is it a problem if you do the processing twice until this issue is resolved?

Event in outlook application object model to know when the first click happens on message body box?

I am developing a add-in to perform some actions when the first click happens on the message box in outlook (2013 version). I want to capture the Outlook.MailItem.Recipients as soon as the first click happens on message body box.
Possible approach to do this (just did a quick test, seems to work for 2013):
Register to NewInspector event of the Application object:
Application.Inspectors.NewInspector += ....;
In the event handler, register to the following event:
var editor = newInspector.WordEditor as Word.Document;
editor.Application.WindowSelectionChange += ....;
The handler fires when the selection changes, which is also happening when the user clicks the window.
Please note that you must keep references to all objects in this sample, else the event registrations will get lost.

How do I send an email and close the current inspector from within an Outlook form region?

I have an outlook 2010 AdjoiningFormRegion that contains a single button. The idea is that a user composes an email then clicks my send button instead of the usual outlook send button. My send button will communicate some info to a web service then send the email as usual and close the inspector window? Is this even possible? It would be great to hook into a send event but I've had no luck figuring this out.
The Send method of the MailItem class will send the email and close the window just as clicking the Send button does.
(Globals.ThisAddIn.Application.ActiveInspector().CurrentItem as MailItem).Send()