Question

I'm trying to parse text-based file attachments (txt, doc, etc...). However, I can't seem to get to the binary information itself. I can get the filename and I can save the file out to some temporary folder and open it from there, but that seems messy.

Is there any way to access the content of an attachment without saving it, reading it, then deleting it or am I just chasing my tail?

Was it helpful?

Solution

Redemption will help you here, SafeMailItem.Attachments collection has Attachment object that has a property "AsText" check out

http://www.dimastr.com/redemption/

76mel

OTHER TIPS

You can get content of an attachment using Microsoft schema -

   private void GetAttachmentContent(Attachments attachments)
    {
        foreach (Attachment attachment in attachments)
        {
            //microsoft schema to get the attachment content
            string AttachSchema = "http://schemas.microsoft.com/mapi/proptag/0x37010102";
            byte[] filebyte = (byte[])attachment.PropertyAccessor.GetProperty(AttachSchema);
        }
    }

You need to ref : Microsoft.CSharp.dll in code file

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top