How to know which MailItem I am replying/forwarding?

  • Thread starter Thread starter Jinghui
  • Start date Start date
J

Jinghui

I am developing an Outlook 2003 shared add-in in VS2005 (c# & c++). It reads
the internet headers of an extermail. When I double click on a message, it
returns the headers ok, but when I click on reply/forward, the internet
headers get striped.

Is there a way of knowing the original mailitem that is replied/forwarded.
 
Use item.ConversationTopic and item.ConversationIndex. A reply/forward will
have the same ConversationTopic as the original and a ConversationIndex
that's a little longer than the original item.
 
Thanks Ken for your quick reply.

Does it mean I will need to loop through all the mail messages (in all
different folders) to find the original?

My InternetHeaderReader method takes an outlook mailitem as the input
parameter.
 
If the user is replying to or forwarding items they have to do it from a
folder and that folder would have to be ActiveExplorer.CurrentFolder. So
when that changes you have to react to that and instantiate that folder and
its Items collection. At that point you can use a filter or restriction on
that Items collection using the ConversationTopic property and only have to
look at those items with the identical ConversationTopic. That narrows it
down significantly.

To detect when the current folder changes you'd use the
Explorer.BeforeFolderSwitch event most likely, although you can also use the
FolderSwitch event instead.
 
Or you can subscrive to the events on all items in the Explorer.Selection
collection and trap the MailItem.Reply/ReplyAll/Forward events.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
Or you can subscrive to the events on all items in the Explorer.Selection
collection and trap the MailItem.Reply/ReplyAll/Forward events.

Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy  - Outlook, CDO
and MAPI Developer Tool







- Show quoted text -

Dimitry could you explain what you ment by this as i am not getting
what you mean ?

thanks

marcus
 
Here's what Dmitry meant. Say the Selection collection has 3 items selected.
You instantiate 3 separate object variables and subscribe to the Reply,
ReplyAll and Forward events for each of those items. That way you know if
the user took one of those actions on the selected items. If Selection
changes a subscription to the SelectionChange event will tell you that, you
release the objects from the previous selection and subscribe to the newly
selected items.




Or you can subscrive to the events on all items in the Explorer.Selection
collection and trap the MailItem.Reply/ReplyAll/Forward events.

Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
<snip>Dimitry could you explain what you ment by this as i am not getting
what you mean ?

thanks

marcus
 
Back
Top