|
|
|||
| Outlook and .NET Printer Friendly Version | |||
|
|
Writing code with C# and VB.NET to create Outlook add-ins and other projects | ||
| Topic | |||
|
|
Forward PostItem - Get Entry ID of original PostItem in MailItem
My application adds new items to Outlook as PostItems. I track all of my items via EntryID. I want to be able to capture when one of my PostItem's has been forwarded via email. When forwarding, a new MailItem is created with the body of my PostItem, so my Inspector wrapper has no way of linking the new MailItem back to it's original PostItem. What's the best way to do this? I'm very experienced with the Outlook Object Model and expect this to be an advanced solution. Nick Harris 20-Sep-2007 23:44 |
||
|
|
Nick Harris
20-Sep-2007 23:49
I should add the Extended MAPI works for me as well. |
||
|
|
Sue Mosher
21-Sep-2007 07:17
What about stamping the post item body with the EntryID, say, as the last line? That way the MailItem would have the EntryID, which your application could strip from the forwarded message. The only other solution I can think of is to subscribe to the Forward event for all the post items that you want to track. |
||
|
|
Nick Harris
24-Sep-2007 20:07
Stamping the post item body was actually the work around I was thinking about, but figured I would ask first... I'll give that a shot. Priorities have me working on some other stuff at the moment, but when I get back to this I'll post about how it goes. |
||
|
|
Nick Harris
27-Sep-2007 22:49
Stamping the original PostItem.HTMLBody with my unique identifier (in my case it’s different than the Entry ID) then retrieving that from the HTMLBody of the CurrentItem in my Inspector wrapper is how I implemented this. Basically, when I create my original PostItem, I add a hidden html input element to the end with my identifier (<input type="hidden" id=”XXX” value=”YYY” />). This way it’s available in the MailItem.HTMLBody, but not visible to the user. In my InspectorWrapper, I look for my hidden input element in the CurrentItem based on the id I gave it and parse out the value if it’s there. The actual implementation is pretty involved so I’ll skip it here unless someone replies looking for more details. This implementation works very well for me though. My goal is to track how many people one of my PostItems is forwarded to. By wrapping the Inspectors and figuring out if the item is one of mine, I can subscribe to the MailItem.Write event and get the number of recipients through MailItem.Recipients. Very cool! |
||
|
|
Sue Mosher
28-Sep-2007 06:31
Very cool indeed! Interesting idea using <input type="hidden">. Have you seen any problem getting Outlook 2007 to include that tag in the reply, given that it's one of the ignored elements per http://msdn2.microsoft.com/en-us/library/aa338201.aspx ? |
||
|
|
Nick Harris
28-Sep-2007 10:20
I'm developing against Outlook 2007 and it works great. If I send the email to myself, it's no longer in the incoming message, but it is there in the prior to sending. |
||
|
|
Smoller
22-Nov-2007 07:44
I am trying to do something like it, but i do not have much success :( What i am trying to do is this: I recieve a mail, and stores it in Sharepoint. During that process i add some info to the mail so i, when i open it in Outlook at a later time will know what sharepoint site it came from. I store this information as a hidden field as you mentioned above. This is all very well. I re-open the message, and in "View source" the hidden field shows. Now, when i reply (or forward) the mail, the hidden field is stripped from the HTMLBody :-( Isnt there any way when you are in "reply-mode" that you can get a referance to the original MailItem? |
||
|
|
Sue Mosher
22-Nov-2007 08:15
Smoller, see my last response to Nick about how <input type="hidden"> is ignored in Outlook 2007 HTML and http://www.outlookcode.com/codedetail.aspx?id=1714 for a code sample that shows how to find the parent message for a reply or forward. |
||
|
|
jon
03-Apr-2008 09:26
I am trying to accomplish the same function that a routing slip did in office 2003 but in office 2007 I just need to see who has the email at any givin time any ideas |
||
|
|
saeed
03-Apr-2008 09:48
You can poll for new message in exchange server ( if you have an access to the server ) |
||
|
|
|||
