views:

435

answers:

2

We have created a VSTO addin for Outlook Meetings.

As part of this we trap on the SendEvent of the message on the FormRegionShowing event:

_apptEvents.Send += new Microsoft.Office.Interop.Outlook.ItemEvents_SendEventHandler(_apptEvents_Send);

The method _apptEvents_Send then tests on a couple of properties and exits where appropriate.

private void _apptEvents_Send(ref bool Cancel)
{
if (!_Qualified)
                    {
                        MessageBox.Show("Meeting has not been qualified", "Not Qualified Meeting", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        chkQualified.Focus();
                        Cancel = true;
                    }
}

The problem that we're having is that some users' messages get sent twice. Once when the meeting is sent and a second time when the user re-opens outlook.

I've looked for memory leaks, thinking that something might not be getting disposed of properly, and have added explicit object disposal on all finally calls to try and make sure resources are managed, but still getting the functionality incosistently across the organization. i.e. I never encountered the problem during development, nor other developers during testing. All users are up to date on framework (3.5 SP1) and Hotfixes for Outlook.

Does anyone have any ideas on what might be causing this?

Any ideas anyone might have would be greatly appreciated.

A: 

i'm no pro, but I've had trouble in the past when doing outlook automation due to people's send mail settings.

For example, my mail only sends when i force a send/receive cycle. Most people have outlook to send immediately though and I remember some headaches when someone first asked for the really simple automation scripts.

see if this is something that all the developers have in common and the user's may have set up differently.

Bryan
A: 

Hi, Why do you use Microsoft.Office.Interop.Outlook.ApplicationEvents_10.Send Event Instead of adding the given handler over and over again.

On startup method of your vsto addon, just add :

((MSOutlook.ApplicationEvents_10_Event)_OutlookApp).ItemSend += new Microsoft.Office.Interop.Outlook.ApplicationEvents_10_ItemSendEventHandler(Utils_ItemSend);

  void Utils_ItemSend(object Item, ref bool Cancel)
  {
        //Do your operation here.
  }

Regards Kerem Kusmezer