View Single Post
  #7  
Old April 6th 09, 05:03 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default add-in won't load

You don't need to do anything for passing the event back to Outlook, it's
Outlook that fires the event for you. It will also only fire the event on an
Explorer you have instantiated, so this event should not be firing in Outbox
unless you switch the Explorer to viewing the Outbox. You should not be
doing that if that's what you are doing. Leave things in Outbox alone and
don't mess with them after sending or the items will just remain in Outbox
and never get sent.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Jason" wrote in message
...
The problem of mail not going out only occurs on Outlook 2007, not 2003.

I believe it is caused by the interception of Explorer's SelectionChange
event.

//class level variable to hold event handler
private Outlook.Explorer explorer = null;

private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
explorer = this.Application.ActiveExplorer();
explorer.SelectionChange += new
Outlook.ExplorerEvents_10_SelectionChangeEventHand ler(ThisAddIn_SelectionChanged);
}

private void ThisAddIn_SelectionChanged()
{
// only handle appointments, nothing else
if (explorer.Selection.Count 0 && explorer.Selection[1] is
Outlook.AppointmentItem)
{
...
}
}

Once a new mail is created, Outlook put it into Outbox folder and fires 3
SelectionChange events.

I know JavaScript DOM event bubble up and vaguely remember one article
mentioned about passing Outlook event out of event handler. How do I pass
the Explorer's SelectionChange event back to Outlook, so Outlook can
handle it as usual?


Ads