Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Environment is Sharepoint 2010. The issue I'm running into is essentially the one that occurred here: http://social.technet.microsoft.com/Forums/en-US/sharepointadmin/thread/f74ca4cb-44fe-4918-b206-b6616458a524 except that I am running a custom email event receiver instead of the native SharePoint one.

The section that handles the attachments happens here:

foreach (SPEmailAttachment attachment in emailMessage.Attachments)
    byte[] attachmentArray = new byte[attachment.ContentStream.Length];
    attachment.ContentStream.Read(attachmentArray, 0, (int)attachment.ContentStream.Length);
    item.Attachments.Add(fileName, attachmentArray);

This code works fine for every attachment that I've tried, with the exception of .msg files. When any kind of .msg file is attached to an incoming email, no attachments appear and my event receiver logs an error that there were special characters that are not allowed in a file name. Even the most harmlessly named files like "a.msg" gives this error. Has anyone run into this problem with email attachments for an incoming email enabled list?

share|improve this question
Maybe the filetype ist blocked? –  Sascha Feb 22 '13 at 20:38
I checked and unfortunately it is not. The default SharePoint event handler can handle .msg attachments, but I need to attach an event receiver to deal with the files/emails as they come in. Adding an event receiver to "ListItemAdded" does not behave properly. –  user11457 Feb 22 '13 at 20:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.