![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
Does anybody know how to get an Outlook.MailItem, set its underlying MAPI
properties, and display it appropriately without saving it? I have an RFC 822 message that I need to manipulate and display in Outlook, but I want to avoid saving it so that it doesn't end up being replicated back to their Exchange server. Even if I delete the item immediately after displaying it, it may still incur the network cost of being uploaded, and if deleted item retention is enabled, it'll still hang around. Outlook doesn't expose any way to do this. You can ask it to open a .msg file, but .msg files have their own problems (e.g. with large numbers of recipients) and the .msg file has to be cleaned up at some point. Also, I may want to reply to or forward the message rather than merely display it, which is tricky with just the command-line invocation of Outlook. I tried creating a Outlook::MailItem through the Outlook API, calling SetProps on its MAPIITEM member, and then displaying it, but that was all sorts of fail. It created in the Drafts folder no matter what I tried to do, and the message was blank rather than reflecting the properties I'd set (even though OutlookSpy showed the right properties on the message). These are probably fixable issues eventually, but I suspect I'm coloring way outside the lines here. I've also tried using Redemption, which will import the RFC 822 message and display it, but seems to have problems showing it as sent The following script will display a message as unsent unless it's saved and reopened: Set Session = CreateObject("Redemption.RDOSession") Session.MAPIOBJECT = Application.Session.MAPIOBJECT Set Msg = Session.GetDefaultFolder(16).Items.Add(6) Msg.Sent = True Msg.Import "x:\dev\test.eml", 1024 Msg.Display Redemption will, however, load the .msg file and let me manipulate the Outlook item however I wish. My current jerryrigged solution is to convert the RFC 822 file to a .msg file then use Redemption to load the .msg file, but that seems overly elaborate. I'm not sure how Redemption is doing this under the hood-- the resulting Outlook message shows up as not being a child of any folder and not savable, which is pretty cool; it's almost identical to how Outlook shows .msg files. So: does anybody have any better ideas of how to accomplish any of this? Cain T. S. Random Software Engineer Barracuda Networks Inc. Tel: 734-302-3001 x7019 Mobile: 734-709-2443 Fax: 734-302-3067 |
Ads |
#2
|
|||
|
|||
![]()
The Redemption route is probably your best option, otherwise you have to use
Extended MAPI (unmanaged C++ or Delphi only) to replicate what Redemption is doing. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "Cain T. S. Random" wrote in message ... Does anybody know how to get an Outlook.MailItem, set its underlying MAPI properties, and display it appropriately without saving it? I have an RFC 822 message that I need to manipulate and display in Outlook, but I want to avoid saving it so that it doesn't end up being replicated back to their Exchange server. Even if I delete the item immediately after displaying it, it may still incur the network cost of being uploaded, and if deleted item retention is enabled, it'll still hang around. Outlook doesn't expose any way to do this. You can ask it to open a .msg file, but .msg files have their own problems (e.g. with large numbers of recipients) and the .msg file has to be cleaned up at some point. Also, I may want to reply to or forward the message rather than merely display it, which is tricky with just the command-line invocation of Outlook. I tried creating a Outlook::MailItem through the Outlook API, calling SetProps on its MAPIITEM member, and then displaying it, but that was all sorts of fail. It created in the Drafts folder no matter what I tried to do, and the message was blank rather than reflecting the properties I'd set (even though OutlookSpy showed the right properties on the message). These are probably fixable issues eventually, but I suspect I'm coloring way outside the lines here. I've also tried using Redemption, which will import the RFC 822 message and display it, but seems to have problems showing it as sent The following script will display a message as unsent unless it's saved and reopened: Set Session = CreateObject("Redemption.RDOSession") Session.MAPIOBJECT = Application.Session.MAPIOBJECT Set Msg = Session.GetDefaultFolder(16).Items.Add(6) Msg.Sent = True Msg.Import "x:\dev\test.eml", 1024 Msg.Display Redemption will, however, load the .msg file and let me manipulate the Outlook item however I wish. My current jerryrigged solution is to convert the RFC 822 file to a .msg file then use Redemption to load the .msg file, but that seems overly elaborate. I'm not sure how Redemption is doing this under the hood-- the resulting Outlook message shows up as not being a child of any folder and not savable, which is pretty cool; it's almost identical to how Outlook shows .msg files. So: does anybody have any better ideas of how to accomplish any of this? Cain T. S. Random Software Engineer Barracuda Networks Inc. Tel: 734-302-3001 x7019 Mobile: 734-709-2443 Fax: 734-302-3067 |
#3
|
|||
|
|||
![]()
Thanks, Ken.
I'm using Extended MAPI anyway, hence the seeming redundancy of using Redemption. However, I can't figure out how it's creating an Outlook::MailItem, setting the properties of its underlying MAPIObject, and getting it to display right. At least, that's what I assume it's doing... you certainly can't do it the other way around (i.e. create a MAPI item and then attach it to an Outlook::MailItem). P.S. I have your "Outlook 2007 Programming" in front of me. Thanks for the great book. "Ken Slovak - [MVP - Outlook]" wrote in message ... The Redemption route is probably your best option, otherwise you have to use Extended MAPI (unmanaged C++ or Delphi only) to replicate what Redemption is doing. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "Cain T. S. Random" wrote in message ... Does anybody know how to get an Outlook.MailItem, set its underlying MAPI properties, and display it appropriately without saving it? I have an RFC 822 message that I need to manipulate and display in Outlook, but I want to avoid saving it so that it doesn't end up being replicated back to their Exchange server. Even if I delete the item immediately after displaying it, it may still incur the network cost of being uploaded, and if deleted item retention is enabled, it'll still hang around. Outlook doesn't expose any way to do this. You can ask it to open a .msg file, but .msg files have their own problems (e.g. with large numbers of recipients) and the .msg file has to be cleaned up at some point. Also, I may want to reply to or forward the message rather than merely display it, which is tricky with just the command-line invocation of Outlook. I tried creating a Outlook::MailItem through the Outlook API, calling SetProps on its MAPIITEM member, and then displaying it, but that was all sorts of fail. It created in the Drafts folder no matter what I tried to do, and the message was blank rather than reflecting the properties I'd set (even though OutlookSpy showed the right properties on the message). These are probably fixable issues eventually, but I suspect I'm coloring way outside the lines here. I've also tried using Redemption, which will import the RFC 822 message and display it, but seems to have problems showing it as sent The following script will display a message as unsent unless it's saved and reopened: Set Session = CreateObject("Redemption.RDOSession") Session.MAPIOBJECT = Application.Session.MAPIOBJECT Set Msg = Session.GetDefaultFolder(16).Items.Add(6) Msg.Sent = True Msg.Import "x:\dev\test.eml", 1024 Msg.Display Redemption will, however, load the .msg file and let me manipulate the Outlook item however I wish. My current jerryrigged solution is to convert the RFC 822 file to a .msg file then use Redemption to load the .msg file, but that seems overly elaborate. I'm not sure how Redemption is doing this under the hood-- the resulting Outlook message shows up as not being a child of any folder and not savable, which is pretty cool; it's almost identical to how Outlook shows .msg files. So: does anybody have any better ideas of how to accomplish any of this? Cain T. S. Random Software Engineer Barracuda Networks Inc. Tel: 734-302-3001 x7019 Mobile: 734-709-2443 Fax: 734-302-3067 |
#4
|
|||
|
|||
![]()
Thanks for the compliment.
I'm not sure how Dmitry is doing that in Redemption, you'd have to ask him what goes on under the hood. I just know how to use Redemption from the outside ![]() -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "Cain T. S. Random" wrote in message ... Thanks, Ken. I'm using Extended MAPI anyway, hence the seeming redundancy of using Redemption. However, I can't figure out how it's creating an Outlook::MailItem, setting the properties of its underlying MAPIObject, and getting it to display right. At least, that's what I assume it's doing... you certainly can't do it the other way around (i.e. create a MAPI item and then attach it to an Outlook::MailItem). P.S. I have your "Outlook 2007 Programming" in front of me. Thanks for the great book. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Outlook 2003 problems displaying messages... | Mike | Outlook - General Queries | 0 | September 16th 07 04:58 PM |
Errors displaying Outlook messages in reading pane | Kanga | Outlook - Installation | 0 | June 1st 07 07:05 AM |
Outlook 2002/XP: Displaying Single Incoming Messages up to FIVE times! Why? | David Probett | Outlook - General Queries | 4 | December 24th 06 10:29 AM |
Problem with Outlook 2007 B2 - new messages not displaying body | Chris Ericoli | Outlook - General Queries | 2 | June 6th 06 08:44 PM |
Outlook 2003 POP3 Downloaded Messages, but Not displaying | jwhiteuwc | Outlook - General Queries | 6 | April 4th 06 05:21 PM |