How the mailItem.Close(OlInspectorClose.olDiscard) works?

P

Pavel Rosoi

Hello everybody,

I develop an Outlook 2003 VSTO Add-in in C#.
I modified an existing MailItem in Mail_Open event handler by adding some
attachments and modifing the Body.
I restored the original item in the MailItem.Close event handler and I also
called mailItem.Close(OlInspectorClose.olDiscard). But the
LastModificationTime property changed.
I am wondering how to discard all the modifications performed on an item,
including the LastModificationTime property?
Thank you.



I noticed that the LastModificationTime property changed but my expectations
was to discard all the changes performed on the item.
 
S

SvenC

Hi Pavel,
I develop an Outlook 2003 VSTO Add-in in C#.
I modified an existing MailItem in Mail_Open event handler by adding
some attachments and modifing the Body.
I restored the original item in the MailItem.Close event handler and
I also called mailItem.Close(OlInspectorClose.olDiscard). But the
LastModificationTime property changed.
I am wondering how to discard all the modifications performed on an
item, including the LastModificationTime property?

I noticed that the LastModificationTime property changed but my
expectations was to discard all the changes performed on the item.

This is impossible as the last modification time is automatically set by
MAPI when anything on the item was changed. So if Outlook discards
changes by resetting old values this is also an item modification which
results in an automatic update of the last mod time.

If your design permits it you could try to create a temporary copy of the
item, modify that to your needs. When you are done with that copy you
delete it.
 

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