Hi All,
I am using Outlook 2007 object model inorder to create a Outlook Mail Item (Message). Here is the code snippet that I am using:
Microsoft.Office.Interop.Outlook.Application oOutlookApplication = new Application();
Microsoft.Office.Interop.Outlook.MailItem oMailItem = (Microsoft.Office.Interop.Outlook.MailItem)
oOutlookApplication.CreateItem(OlItemType.olMailItem);
oMailItem.BodyFormat = OlBodyFormat.olFormatHTML;
oMailItem.Body="<html><head><title></title></head>" +
"<body>"+Convert.ToString(sbBody)+"</body></html>";
//sbBody is a string builder object that holds the table with data.
oMailItem.Subject = Convert.ToString(oOutlookListItem["Title"]);
oMailItem.SaveAs(@"D:\\TestMailItem.msg", OlSaveAsType.olMSG);
This is perfectly creating the Outlook mail item that I want. But the problem is that when I try to open the created item, I can directly see the html as body......
but the output must be a table. Not sure what is the issue....
Could anyone guide me in the right direction if incase I am missing out some thing?....
Thanks
Sridhar