Import Outlook folder or PST into SQL?

  • HI all,

    I've got an archive of old emails from a previous employer I want to import in SQL for a little side project - to make the emails easily searchable, queryable, and to do a few things with the contacts. I've stripped all the attachments out because I didn't want to store them or have them cause issues.

    I don't know of a way to do this - exporting the folder in Outlook to CSV is garbage. That CSV file is so mangled with junk...

    I tried access, but get this error in 2013 when trying to import for an external source

    Microsoft Access can't find the wizard. This wizard has not been installed, or there is an incorrect setting in the Windows Registry, or this wizard has been disabled.

    I don't have any addin - I installed Access from the web....i can't imagine an incorrect setting, but I've tried repairing and search Google with no luck...

    Anyone know of any other way? Or a fix to the above Access problem?

  • Initial thought: I would go find another side project to work on...

    No clue about Access issue and you are not likely going to get much help on that from this forum. I would go to MSDN form if you are looking to just solve the specific Access issues.

    If you want to query the contents of an Outlook folder you can use PowerShell. If the PST is attached to the profile in Outlook that you are working with in PowerShell I expect you should be able to hit that as well.

    Shawn Melton
    Twitter: @wsmelton
    Blog: wsmelton.github.com
    Github: wsmelton

  • No. There are over 20,000 emails and a huge amount of contacts. They for some reason (contacts) don't appear in outlook. Also the data is fairly important for consulting projects. I just don't wanna use Outlook as the means for searching.

  • If I remember correctly, your MSAccess error is telling you that it can't find a wizard. to get the import/export wizard you have to "install advanced features" when installing Access. Again, IIRC this also installs linked table manager and a few other tools.

  • It's been a long time ago, but I vaguely recall using LINQ (or OLEDB directly) to query data from Outlook.

    http://thedatafarm.com/data-access/using-linq-to-query-outlook-emails-joined-with-sql-data/

    "Do not seek to follow in the footsteps of the wise. Instead, seek what they sought." - Matsuo Basho

  • If you just want a decent searchable index, you could always just link Outlook to a Gmail account and drag the PST folders in:

    http://www.theatlantic.com/technology/archive/2010/01/moving-pst-files-into-gmail-you-can-try-this-at-home/34209/

  • This was removed by the editor as SPAM

    1. In Outlook, do NOT do an EXPORT. Instead, open the folder from which you want to archive messages.
    2. Sequence the messages as desired. I order by date sent to allow for an arbitrary time frame.
    3. Highlight the messages to be copied out. (Click, Shift+Click or press Ctrl +A for all.)
    4. In the File menu, click Save As and enter an appropriate file name. This will give you a very simple text file of continuous text for all selected emails. If you want separate messages, unfortunately you will need to select one message at a time.
    5. In SQL Server, create a table containing an identity column followed by a varchar(4000) column. Import your text file into this table, which preserves physical sequence via the identity, and a text column for each line. Depending on your SQL skills, you may parse this table as desired. The many SQL functions such as, but not limited to, LTRIM, RTRIM, LIKE, ISNUMERIC, SUBSTRING, LEFT, RIGHT, LEN, PATINDEX, CHARINDEX etc. allow you to extract into variables from the text strings.

    Hope This Helps,

    Peter

Viewing 9 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic. Login to reply