swapmeet_Lou
swapmeet_Lou

Reputation: 292

Calling C# method or function after Outlook email send button is pressed?

I have a small application that triggers an Outlook email to populate for a user to send based off another ASP gridview selection. My final piece of this is triggering a C# method in code behind. I want the method to be triggered once the user presses the send button on the newly opened email.

I have found some information on Application.Itemsend, but not enough to really tell me if this is the correct answer.

What do I need in order to capture the Send button event and trigger code behind?

Upvotes: 0

Views: 508

Answers (1)

Evanzheng
Evanzheng

Reputation: 211

We can use the following code to get the send button event and bind the event to it. You can refer to the following code.

private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {

            this.Application.ItemSend += Application_ItemSend;
        }

        private void Application_ItemSend(object Item, ref bool Cancel)
        {
            MessageBox.Show("Test");
        }

This code indicates that a "text" window pops up when the send button is clicked.

Upvotes: 1

Related Questions