Yes you are right. The problem only occurs when user clicks the Outbox
folder then create a new mail. No problem if user has not highlighted the
Outbox.
Once the mail is stalled, no matter how many times you click Send and
Receive button, it will stay there forever, even after user move to other
folder or restart Outlook. You have to delete it, and create an new mail.
What can I do then? Tell user not to select Outbox, or unselect the Outbox
programmatically if user does that?
Ken Slovak - said:
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.
Jason said:
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_SelectionChangeEventHandler(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?