We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

MSG Attachment in a MSG

Hi,

I have successfully been testing Aspose.Email with SharePoint 2010 using a C# custom action to read .msg files that have been uploaded to a document set. I have seen two issues when running the custom action - firstly the msg.BodyHtml output sometimes causes an invalid text error when copied to a enhanced multiline text field (msg.Body is always okay). Secondly, if an msg file has msg attachments then I get an 'Object reference not set...' error.

There are a number of reported issues with 'mail with mail attachments' in the forum but none specifically for SharePoint...this is the closest to my issue...

https://forum.aspose.com/t/38362https://forum.aspose.com/t/38362

Do you have any sample SharePoint code for this similar to the .NET sample in the link above?

Thanks

Gary

Hi Gary,


The code sample that you have referred to is the right one to extract embedded MSG attachments from a message. Since you are using custom C# action to read these MSG files, the same code sample applies in this case as well to read the MSG files from Sharepoint document set. The actual issue may be with the way Aspose.Email for handling these MSG files.

You can test it by saving the MSG files from your SharePoint library to disc and then using simple console application with Aspose.Email for .NET to read these MSG files. The same issues should exist. In order to further investigate these issues, we need these sample MSG files to reproduce the issue at our end and report to our development team for further consideration.

Looking forward to assist you further.

Hi Kashif,

I will try using the FromStream for msg attachments to see if that help...I'm not sure if saving to disk will work as I expect to get the same error before it completes...

Thanks

Gary

Hi Gary,


I think I was not clear enough in my previous message. As you are getting error with the attachment message in a message, you won’t be able to process it further. If you could download the main message (not the embedded message in the main message) from your sharePoint document library and provide to us, we may test it with the latest version of Aspose.Email and report it accordingly to our development team for further investigation. Please let us know if it needs further clarification.

Hi Kaskif,

Are you able to test this in SharePoint 2010 using any msg file with a msg attachment created with Outlook 2010 or do you not need SharePoint to test?

I am

Hi Gary,


We are sorry for a delayed response.

With reference to the article, Reading Email Messages from SharePoint document library, you need to have the SharePoint SDK installed on the system. The code sample actually shows how to get access to the MSG file and then load it in MemoryStream. Till this point, Aspose.Email API is not required. Once the MSG file is available, it is loaded from the stream using the MailMessage for further processing. Since the MSG is now available in stream, Aspose.Email is not dealing with SharePoint but with a MSG file from a stream,and that is why I requested you to provide this MSG file for our further investigation.

I am further investigating this issue at my end with a number of MSG files having attachments and will share my findings here shortly.

Hi Kashif,<?xml:namespace prefix = o ns = “urn:schemas-microsoft-com:office:office” /><o:p></o:p>

Do you want me to send you my code…it successfuly saves
the email into SharePoint using MemoryStream, MapiMessage and
MapiAttachmentCollection, saves the attachments into the same document library
unless it is also a .msg…this is what seems to cause the exception…

Regards

Gary

Hi Gary,


Could you please:
  1. Tell us which version of Aspose.Email for .NET are you using?
  2. Provide us your sample runnable code that we can use to reproduce this issue at our end?
  3. Provide any sample message that you are using as a test case?
We’ll look into it as soon as possible and provide you further assistance in this regard?

Hi,

I have downloaded release 3.3 to test again but I have also changed my code so it does not upload the attachment if it is a .msg file...I will let you know if testing with 3.3 differs from 3.2.1.

Thanks

Gary

Hi Gary,


I have retested this issue with the latest version of Aspose.Email for .NET 3.3.0 and it is working fine at my end. I would request you to please test the issue at your end and if you still face the problem, please share the above mentioned requirements with us. We’ll look into it as soon as possible to assist you further.

Hi,

I have tested again with 3.3 after updating my code and Aspose.Email is working correctly.

Thank you for your time with this...

Regards

Gary