Topry

I'm looking for a way to programmatically create a MailItem reply from an existing .MSG file using Outlook 2003.

I can open/extract information from the MSG using .CreateItemFromTemplate, but the .Reply method will not work on that mailitem, ostensibly since it is not in Outlook.

I saw another posting from Sue Mosher on the Namespace.OpenSharedItem method in Outlook 2007 that apparently can be used to add an existing MSG back into Outlook. However, I have not found anything equivalent for Outlook 2003.

The primary problem with creating a new mailitem and populating the to/from/subject and body is the body itself. Outlook will automatically add the To/From/Subject and item break line when creating a reply, which is what Im trying to accomplish by using Outlook to create the reply vs manually populating a new mailitem.



Re: Visual Studio Tools for Office Creating a Reply from an Outlook 2003 MSG file

Sue Mosher - Outlook MVP

There is no equivalent for Outlook 2003 in the Outlook object model. You'd need to use Redemption, which has an Import method.

The reason that CreateItemFromTemplate doesn't work is not because the item is not in Outlook, but because it is a new item not a copy of the original.





Re: Visual Studio Tools for Office Creating a Reply from an Outlook 2003 MSG file

Topry

Thank you Sue, I have used Redemption in the past and will check into it for this purpose. Though, modifying the body dymanically is looking like a simpler/cleaner solution than adding/replying/removing the mailitem from Outlook.





Re: Visual Studio Tools for Office Creating a Reply from an Outlook 2003 MSG file

Sue Mosher - Outlook MVP

If you're trying to create a reply, though, don't you need the original sender information That's not going to be in the body of the item, nor is it available in the copy created with CreateItemFromTemplate.





Re: Visual Studio Tools for Office Creating a Reply from an Outlook 2003 MSG file

Topry

Yes, and I am able to get it from the MSG file after CreateItemFromTemplate. These msg files were created via drag/drop - all properties in the MailItem object appear to be intact/accessible...am I missing something





Re: Visual Studio Tools for Office Creating a Reply from an Outlook 2003 MSG file

Sue Mosher - Outlook MVP

Becaus CreateItemFromTemplate creates a new message that is an unsent copy of the original, I would have expected the SenderEmailAddress property to return a blank string. But it looks like it is indeed carrying over useful information like SenderEmailAddress. It's nice to get some good news for a change!