Outlook items not discarding changes

J

Josh Einstein

In my add-in, I have WinForms that edit underlying Outlook items. In the new
version of my add in, I update the underlying Outlook item in realtime to
better reproduce what goes on in a normal Inspector so that other properties
get updated and such. This has introduced a strange problem, however.

If I close without saving, any changes I made to the Outlook item (such as a
ContactItem's FullName for example) remain visible the next time I open the
item, even though I've issued ContactItem.Close(olDiscard). If I close and
restart Outlook, the changes are discarded correctly, but until I exit
Outlook, the changes are still visible. I've tried using ReleaseComObject
until I zero out the references to no avail.

OutlookSpy shows the Outlook ContactItem the same way my app sees it (with
the changes) but interestingly enough, the IMessage does not reflect the
changes which is what I want. Is there a way to refresh the Outlook item
from the store?

Any ideas are much appreciated.
 
H

Henry Gusakovsky

That is the result of not releasing OOM objects.

Outlook maintain the internal cache of opened items.
Every time you open item it checks if it's already open and returns
reference from cache
if item is in cache.

With best regards
Henry
 

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