Hi,
I am currently evaluating Aspose.Network for use in one of our Products and have come across an unexplained error that I cannot resolve.
I am trying to get out the various Body properties for use in a Email preview form.
I am having no problems pulling out the HTMLBody and Body properties for .MSG files that are either HTML or Text-only messages, but when I try to Load the message from a .MSG file and the .MSG file is an RTF message I get the error "Cannot access closed stream".
I am using Outlook 2007 and created the message by selecting Rich Text from the Format Group on the Options Tab of the Message Ribbon (as per the attached jpg), sending it to myself and then Saving As .MSG. I have attached the .MSG file in question to this post.
I have tried both of the following pieces of code to load the resulting .MSG file with the same result.
msg = MailMessage.Load(sMsgFileName, MessageFormat.Msg);
OR:
MapiMessageReader rdr = new MapiMessageReader(sMsgFileName);
mapimsg = rdr.ReadMessage();
The full stack trace is shown below.
Do you have any idea why this is happening and if there is a work around or fix in the pipeline.
Thanks!
Aaron.
" at System.IO.MemoryStream.get_Length()\r\n at Aspose.Network.Outlook.Storage.xd8c3135513b9115b.xe32d771fa0f8a73f(xe7be411416cfcd54 x630baaeb4d769680, xd686a7cfdb7bddb2 x5e4607c99a2c3e96)\r\n at Aspose.Network.Outlook.Storage.xd8c3135513b9115b.x0acd3c2012ea2ee8(Stream xcf18e5243f8d5fd3)\r\n at Aspose.Network.Outlook.x574bf3c3b35f401a.xf098323036d9ec26(x31c27b53bd5bfc49 xb6a159a84cb992d6, x525841b533d691b1 x72a03a41ff923a0b, xe7be411416cfcd54 x1aaf12d6975c8115)\r\n at Aspose.Network.Outlook.x0a2cab917e993500.Consume(xc1a5328245d170a8 message, x31c27b53bd5bfc49 parent, x525841b533d691b1 children, xe7be411416cfcd54 storageStream)\r\n at Aspose.Network.Outlook.xc2127bbe5f9a7dea.x8de50eb9cded41f8(xc1a5328245d170a8 x1f25abf5fb75e795, x31c27b53bd5bfc49 xda5bf54deb817e37, xe7be411416cfcd54 x1aaf12d6975c8115)\r\n at Aspose.Network.Outlook.xd58cfdd88485d179.Consume(xc1a5328245d170a8 message, x31c27b53bd5bfc49 parent, x525841b533d691b1 children, xe7be411416cfcd54 storageStream)\r\n at Aspose.Network.Outlook.xc2127bbe5f9a7dea.x8de50eb9cded41f8(xc1a5328245d170a8 x1f25abf5fb75e795, x31c27b53bd5bfc49 xda5bf54deb817e37, xe7be411416cfcd54 x1aaf12d6975c8115)\r\n at Aspose.Network.Outlook.MapiMessageReader.ReadMessage()\r\n at ShowEmail.Form1.button1_Click(Object sender, EventArgs e) in D:\\My Documents\\Visual Studio 2008\\Projects\\Preview Email\\ShowEmail\\Form1.cs:line 35\r\n at System.Windows.Forms.Control.OnClick(EventArgs e)\r\n at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)\r\n at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)\r\n at System.Windows.Forms.Control.WndProc(Message& m)\r\n at System.Windows.Forms.ButtonBase.WndProc(Message& m)\r\n at System.Windows.Forms.Button.WndProc(Message& m)\r\n at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)\r\n at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)\r\n at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)\r\n at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)\r\n at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)\r\n at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)\r\n at ShowEmail.Program.Main() in D:\\My Documents\\Visual Studio 2008\\Projects\\Preview Email\\ShowEmail\\Program.cs:line 17\r\n at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)\r\n at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()\r\n at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)\r\n at System.Threading.ThreadHelper.ThreadStart()"