Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am looking (and so far not finding any) for a solution to archive e-mail items from my Outlook into SQL Server.

My PST is beginning to get really really big, and I'd love to extract my older e-mail into SQL Server in a way so I can still easily find mails if needed. I would prefer SQL Server as the storage medium since I'm familiar with it, and it's rock solid - I don't want to have a collection of PST files or CHM files or anything like that.

Does anyone know of such a solution?

share|improve this question

2 Answers 2

This probably isn't exactly what you're looking for, but it's a start (and free!). It's an Outlook macro I wrote a while back to do just this. The biggest issue is it doesn't do attachments which could be a showstopper for you, but thought I'd share anyway. You click on a folder you want to export and it sends the message info to a SQL table. It's easy enough to modify this if you want more fields.

Sub ExportMsgData()
    Dim objConn As New ADODB.Connection
    Dim rsMsgs As New ADODB.Recordset
    Dim strDBFile As String

    On Error Resume Next
    Set objConn = New ADODB.Connection
    With objConn
        .ConnectionString = "Provider=SQLOLEDB;data source=MySQLSvr;initial catalog=MyMail;integrated security=SSPI"
        .Open
    End With

    Set objExp = Application.ActiveExplorer
    If objExp.Selection.Count > 0 Then
        If objExp.Selection(1).Class = Outlook.OlObjectClass.olMail Then
            For Each objMsg In objExp.Selection
                With rsMsgs
                    .CursorLocation = adUseClient
                    .Open "SELECT TOP 1 * FROM t_Msg", objConn, adOpenDynamic, adLockBatchOptimistic
                    .AddNew
                    !MsgFrom = objMsg.SENDERNAME
                    !MsgFromEmail = objMsg.SenderEmailAddress
                    !MsgDateSent = objMsg.SentOn
                    !MsgDateReceived = objMsg.ReceivedTime
                    !MsgSubject = objMsg.Subject
                    .UpdateBatch
                    rsMsgs.Close
                End With
            Next
        End If
    End If

    objConn.Close
    Set rsMsgs = Nothing
    Set objConn = Nothing
End Sub
share|improve this answer
    
Thanks for sharing - I'm still hoping to find a full-fledged solution. I'm amazed there doesn't seem to be anything out there - I would imagine a lot of people are faced with similar situations. –  marc_s Apr 6 '10 at 18:24
up vote 0 down vote accepted

I'm still amazed no one has really been able to come up with an answer.... what do you guys do to archive your e-mails? Toss 'em out of Outlook or Thunderbird after 6 months and forget about them?? Store them as .txt or .eml files somewhere??

Anyway, the best solution I've found so far isn't using SQL Server - but it still looks quite powerful and useful: MailStore Home - free for personal / home use, and quite nifty at that. Too bad it doesn't support direct .pst file import :-( - that's only in the $$$$$ pro server version, but so far, that's the only bitter-sweet moment with this app.

share|improve this answer

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.