Reading mailitem after mail is send give runtime error.

J

JIGNESH

Hi,

I have inspectorClose event, i am reading entryID, Subject etc in this event.
It works well when any existing mail is opened and closed.

but if a new email is composed then
1. In Application_ItemSend event there is no EntryId generated, which means
mail it not yet send.

2. In inspectorClose event when i attempt to read EntryID, i get an error
message
that "item is moved.....".

What is the correct way to handle this.

Regards
Jignesh
 
K

Ken Slovak - [MVP - Outlook]

No item has an EntryID until it's saved. If it's sent without saving the
EntryID is set after sending when the item is moved to wherever, usually
Sent Items.

For Exchange mailboxes when an item is moved the EntryID is changed. That
doesn't happen with PST files, the behavior depends on the store provider.
So even if the item was saved before sending you can't necessarily rely on
it having the same EntryID after it's sent and moved to Sent Items.

If you want the EntryID before or during sending handle the item.Save()
event and if the item is not yet saved then save it during the Send() event.

If you want the new EntryID after the item is moved to Sent Items, handle
the ItemAdd() event of the Sent Items folder's Items collection.
 

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