How to know which MailItem I am replying/forwarding?

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.
 
K

Ken Slovak - [MVP - Outlook]

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.
 
J

Jinghui

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.
 
K

Ken Slovak - [MVP - Outlook]

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.
 
D

Dmitry Streblechenko

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
 
M

marcus.lambert

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
 
K

Ken Slovak - [MVP - Outlook]

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
 

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