Answer 2
See if below steps works for you.
See if you can Convert MSG file to txt file (http://us.generation-nt.com/best-way-convert-msg-file-txt-help-22848812.html).
Convert txt file into XML format. Use XmlTextReader to read the file content Convert the XML file into your own format using XSLT transformation
Code which can be used for XSLT transformation:
Code I am using for XSLT Transformation:
XslCompiledTransform xslt;
String xsltFileName =”mainTrans.xslt”;
XPAthDocument xDoc ; // reading using XPathNavigation
XsltSettings settings = new XsltSettings(true, false);
XmlUrlResolver resourceResolver = new XmlUrlResolver();
resourceResolver = new ResourceResolver(Assembly.GetExecutingAssembly(), “Prefixdllname”);
XPathDocument xslDoc = new XPathDocument(Assembly.GetExecutingAssembly().GetManifestResourceStream(prefix + "." + xsltFileName));
xslt.Load(xslDoc, settings, resourceResolver); // Loading Embedded XSLT resources into
XslCompiledTransform
// Main document part processing
xslt.Transform(xDoc, args, intermidaryOutput); // Debugging at this point
You can use XmlReader instead of
XPathDocument.
For code sample on codeplex refer link. http://www.codeproject.com/KB/office/MsgReader.aspx
Not sure whether you are allowed to use third party/free source code.
Also Check whether below thread will give you result.
http://blogs.msdn.com/pcreehan/archive/2007/02/06/howto-get-email-messages-from-exchange-to-sharepoint.aspx
Nasir Khan