Outlook 2003 fires an Inspector Close when a send is cancelled

S

Steve D

I have an Outlook COM AddIn that has been working fine with Outlook XP
and Outlook 2003.

However, I have recently updated my Outlook 2003 (to version
11.8002.6568 SP2) and now I am experiencing some problems.

Basically, the latest update appears to send an Inspector Close event
to the addin when a Send is Cancelled - this didn't happen with
previous versions.

Because I have code in the Inspector Close that tidies up and releases
the advise sinks on the Inspector/MailItem objects, when this scenario
occurs my code no longer runs for that Inspector.

The problem can be repro'ed using Outlook Spy using the following
steps

- create a new message
- select the Inspector button from the Outlook Spy toolbar
- click on the Events tab and ensure the 'Close' event is checked
- go back to the draft message and enter a non-resolvable recip (some
random text will do)
- send the message, Outlook will display the "Check Names" dialog
to say that the recipient could not be found
- when you cancel this dialog, you will then see the 'Close' event
fire in the "Inspector" window
- none of the Outlook Spy toolbar buttons now function

Does anyone know a way around this problem?

Should I be doing the tidying/releasing during some other event? I
think I tried to do it in the MailItem Close event but had similar
problems when sends/saves were cancelled

Thanks
Steve
 
S

Steve D

Just as an aside to this - I have also tried trapping the Deactivate
event and then looping through the Inspectors collection to see if
"this" inspector is still present in the collection, and if its not
then I run the tidy code. Unfortunately, there was some bizarre
behaviour (that I can't quite remember) which made it unworkable

Steve
 
K

Ken Slovak - [MVP - Outlook]

This has been reproduced and reported to MS as a bug from that hotfix.

We're trying to find out if a later hotfix might have fixed this, or if not,
when it's scheduled to be fixed.

In the meantime, you can remove that hotfix from Add/Remove Programs in the
Control Panel. It's 892843. It also causes other problems it seems, with
accepting task requests and with using the Folder argument in
CreateItemFromTemplate.
 
K

Ken Slovak - [MVP - Outlook]

Further testing reveals this problem only occurs if using the Outlook email
editor, not with WordMail.

MS is working on a hotfix for this bug.
 
K

Ken Slovak - [MVP - Outlook]

I'm also looking for a workaround, since this will impact some code projects
of my own and you can never depend on users to have the latest update, even
if it's eventually released on Office Update. I'll post back here when I
hear about the QFE or I find a usable workaround.
 
S

Steve D

I did a workaround whereby in the Inspector Close event, I checked
whether the Inspector was still in the Inspectors collection and it it
wasn't then I'd do the tidying up.

This appeared to work ok for all versions of Outlook I tried it on (XP,
2003 with and without this 'patch'), but I've not tested it
extensively.

Steve
 
K

Ken Slovak - [MVP - Outlook]

That might vary depending on if Outlook 2000 was being used and also if an
Inspector wrapper class and collection are being used, which I use a lot.
And I have to support Outlook 2000. I was thinking of that or possibly a
flag set in Item.Send when canceling. That could be checked in
Inspector.Close as well as other procedures like timer events.
 
K

Ken Slovak - [MVP - Outlook]

The fix I coded used a flag and a timer. I needed to do some work in
Inspector.Close but only after a few other things were done. So in Item.Send
I set a Boolean flag and at the top of Inspector.Close I test for that flag.
If True I just exit that event handler. A timer fires 500 ms after leaving
Item.Close and makes some procedure calls to do some things and then clears
the flag and explicitly closes the Inspector. Since the flag is clear the
cleanup code in Inspector.Close did it's work. This seems to have worked
around the bug.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top