tags:

views:

663

answers:

3

My company requires me to use Outlook for my E-mail. Outlook does virtually nothing the way I want to do it and it frustrates me greatly. (I'm not trying to start a flame war here, it must do exactly what thousands of CEO's want it to do, but I'm not a CEO.)

I would like to be able to automatically extract the thousands of E-mails and attachments currently in my Outlook account and save them in my own alternative storage format where I can easily search them and organize them the way I want. (I'm not requesting suggestions for the new format.)

Maybe some nice open source program already can do this... that would be great. Please let me know.

Otherwise, how can I obtain the message content and the attachments without going through the huge collection manually? Even if I could only get the message content and the names of the attachments, that would be sufficient. Is there documentation of the Outlook mail storage format? Is there a way to query Outlook for the data?

Maybe there is an alternative approach I haven't considered?

My preferred language to do this is C#, but I can use others if needed.

+4  A: 

Outlook Redemption is the best thing currently to use that I have found. It will allow you to get into the messages and extract the attachments and the message bodies. i am using it now to do just that.

Here is some code I use in a class. I included the constructor and the processing function I use to save off the attachments. I cut out the code that is specific to my needs but you can get an idea of what to use here.

    private RDOSession _MailSession = new RDOSession();
    private RDOFolder _IncommingInbox;
    private RDOFolder _ArchiveFolder;
    private string _SaveAttachmentPath;

    public MailBox(string Logon_Profile, string IncommingMailPath, 
                   string ArchiveMailPath, string SaveAttPath)
    {
        _MailSession.Logon(Logon_Profile, null, null, true, null, null);
        _IncommingInbox = _MailSession.GetFolderFromPath(IncommingMailPath);
        _ArchiveFolder = _MailSession.GetFolderFromPath(ArchiveMailPath);
        _SaveAttachmentPath = SaveAttPath;
    }
public void ProcessMail()
        {

            foreach (RDOMail msg in _IncommingInbox.Items)
            {
                foreach (RDOAttachment attachment in msg.Attachments)
                {
                    attachment.SaveAsFile(_SaveAttachmentPath + attachment.FileName);
                    }
                }
                if (msg.Body != null)
                {
                    ProcessBody(msg.Body);
                }

            }

        }

edit: This is how I call it and what is passed

MailBox pwaMail = new MailBox("Self Email User", @"\\Mailbox - Someone\Inbox",
                              @"\\EMail - Incomming\Backup", @"\\SomePath");
StubbornMule
A: 

There is an article on this in MSDN.

Outlook Object Model Overview: http://msdn.microsoft.com/en-us/library/ms268893(VS.80).aspx

Remou
+1  A: 

If you want to extract your e-mails take a look at Outlook Email Extractor at codeproject http://69.10.233.10/KB/dotnet/OutlookEmailExtractor.aspx

rob www.filefriendly.com

Rob