Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1037219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T14:49:37+00:00 2026-05-16T14:49:37+00:00

I am creating an Outlook Mail Item object and watching for the Send event.

  • 0

I am creating an Outlook Mail Item object and watching for the Send event. All appears well, but when the Send event fires, the event is raised on the background thread of my application. The reason this is a problem is that this event creates a record of the email sent through my application, which is added to a collection of objects. The collection is therefore raising the List Changed event on the background thread causing a cross-thread control access on the control that displays the collection.

Here is my event hookup:

((Outlook.ItemEvents_10_Event)item).Send += new Microsoft.Office.Interop.Outlook.ItemEvents_10_SendEventHandler(ItemSendWatcher_Send);

The event is hooked up in a basic class which holds a reference to the message being sent, and a delegate to call when the send event is raised. This allows me to pass an instance of the email object to the delegate.

This is my handler:

void ItemSendWatcher_Send(ref bool Cancel)
    {
        if (itemSendDelegate != null)
        {
            this.itemSendDelegate(this.item, ref Cancel); //The delegate with the mail item
        }
        Marshal.ReleaseComObject(item);
        itemSendDelegate = null;
    }

Is this the correct behaviour for this event or am I doing something wrong when constructing the object? Thanks for any help.

Edit: Just to clarify, I am not handling the event in the UI layer, rather in a business object. The delegate called from the Send Event handler causes a new object to be added to a list internally, which causes the list’s ListChanged event to be raised resulting in a handler being called in the control displaying this list. I hope this clarifies what I’m trying to achieve.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T14:49:37+00:00Added an answer on May 16, 2026 at 2:49 pm

    A lot of Forms events are raised on the main window thread which means you often don’t have to worry too much about cross thread concerns. However there are no guarantees and COM will usually not raise events on that thread. The solution is to call this.Invoke(..) with either a delegate to a method or an anonymous block to perform the necessary work on the right thread. To test whether or not this is necessary test this.InvokeRequired.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating an addon for Outlook 2007 that reads a mail item when
I've created a VB.Net application that starts by creating an Outlook application object. I've
I am creating an outlook 2003 addin which adds some dropdown and button on
I am creating an Outlook 2003 version of a Outlook 2007 add-in for appointment
I am in the process of creating an outlook addin. The addin works sort
Microsoft Word has send as attachment functionality which creates a new message in Outlook
I am having some issues creating a setup file for my Outlook 2007 add-in.
I attach to Outlook.Explorer.SelectionChange event. Event handler makes a call to an assembly that
I'm creating outlook appointments using webdav. I'm using following post body to create the
I'm Creating a workflow that needs to send the users an email on set

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.