Hi
I wanted to save Outlook mails in to msg format along with the attachment through C#.
I tried the following code
using Outlook = Microsoft.Office.Interop.Outlook;
private void button1_Click(object sender, EventArgs e)
{
Outlook.Application app = new Microsoft.Office.Interop.Outlook.Application();
Outlook.NameSpace ns = app.GetNamespace("MAPI");
Outlook.MAPIFolder inbox = ns.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);
foreach (Outlook.MailItem item in inbox.Items)
{
item.SaveAs(finename, Outlook.OlSaveAsType.olMSG);
}
}
It could save the mail as msg but the attachment part was removed. SaveAs method had no other overloads alos... :(
If i try to save a message from outlook it saves the message along with the attachment embedded in it. Any idea how this can be achieved..?
I am using .Net Framework 3.5 and Outolook 2007