Strange save request when closing Outlook 2007

E

escamoteur

Hi,

when changing one specific custom prop on a Custom Form Region inspector and then closing the inspector without saving, I get twice
a dialog asking if I want to save changes when closing Outlook but there is no inspector open at this time.

Any idea??

Best
Tom
 
K

Ken Slovak - [MVP - Outlook]

Save the item before closing the Inspector, that should solve the problem.

That can happen if there's any code in event handlers such as Inspector or
item.Close() or Write() or a number of other functions. Just because you
don't see the Inspector still it was open and is now closing and is firing
those prompts.
 
E

escamoteur

Hmmm, but I if the user decides not to save his changes this should be possible. Also it only happens when I change a specific
field.

Even If I wait quite a time before closing outlook after closing the inspector I don't get this requests, only on closing Outlook.
Normaly I should get the request when I close the inspector.

Is there any way to get all changed and not saved items listed?

Best
Tom
 
K

Ken Slovak - [MVP - Outlook]

That is due to a flag that's probably set about your item and it wasn't
fully released by Outlook. I've seen that sort of thing sometimes,
especially if there's code in a custom form as well as in an addin and both
are working on the same item.

In Outlook 2007 there's an Unload() event that fires when Outlook finally
unloads an item from its internal cache, that event can fire long after the
item was closed. I think that's related also to what you're seeing.

You really only have a few choices. You definitely should go over your code
to see what if anything your code changes and which of the events such as
Close() and Write() you're handling. You can also make use of saving an item
and closing it with olDiscard as an argument.

What I usually do, and it works in the majority of cases but not 100% is to
hold a flag for when I save an item using code and I work with that in any
Write() event handler. If I called Write() I take certain steps and if the
user forced Write() I take different steps. I can check the flag and also
the Saved property of the item when it's being closed and decide on actions
to take such as saving or using olDiscard, and if necessary and the item was
saved but I want to discard it I can get EntryID and find it in Drafts and
delete it.
 
E

escamoteur

I tried everything you mentioned. I even removed any of mine registered events but still the same happened. Finally I now found a no
longer used and unbound custom property field on my form region.

Many thanks
Tom
 

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