Asad Ali
Asad Ali

Reputation: 111

How to Import .eml in Outlook VSTO AddIn

How can i import .eml files into Outlook Native Emails So i may store them as local storage. I have .eml files which need to be properly parsed and imported into Outlook Native Emails.

Upvotes: 1

Views: 509

Answers (1)

Asad Ali
Asad Ali

Reputation: 111

You can do that using Redemption Import Feature.

var inbox = RDOSession.GetDefaultFolder(rdoDefaultFolders.olFolderInbox);
RDOMail mailitem = inbox.Items.Add();
mailitem.Import(@"e:\\test.eml", RedemptionSaveAsType.olRFC822);
mailitem.Save();

What this code does is gets the default Inbox folder and creates a empty email item. Then the import function retrieves the .eml file and parses into the email. we can save this to inbox then.

If we are using any Webservices then by fetching the .eml with HttpClient and then import and save it.

Upvotes: 1

Related Questions