Store individual emails into an MS Access database

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

pop3 mail, access 2003, outlook 2003,

I'm looking for a solution where I can export individual emails from Outlook
2003
direct into an MS access database

not all emails that go to that address want to go into the database, just
certain ones that I choose. I've searched for plugins to do this sort of
action without luck,

I'm not sure if I can open and read the PST file, but that would be a good
starting point if possible..

any ideas?

cheers
Dave
 
There's lots of options for reading Outlook data into databases. This page
has all the resources you need:

Connecting Outlook to Databases:
http://www.outlookcode.com/article.aspx?ID=25

This article has an example of pulling in data from an Exchange mailbox:

How to retrieve Exchange and Outlook data with the Jet 4.0 OLE DB provider
in Access 2000:
http://support.microsoft.com/?kbid=275262

A .pst can also be used as the datasource, but I'm not sure if it will work
in the context of the above article. You simply need to make a call using
the NameSpace.GetDefaultFolder method to retrieve a MAPIFolder object for
your Mailbox. Each MAPIFolder has an Items collection with all the messages.
Alternately, you can use the Explorer.Selection event to get just the items
that are currently selected in your active folder.
 
Many thanks for the reply Eric,

I'm currently writing a plugin for outlook where I can right click an email,
select a Client name from a dropdown list (from my database). Then as soon as
i've managed to gather the info from the email (address, subject, body, etc)
I'll be able to use ADO to write them back to my Access Database

Set oAppt = Application.ActiveInspector.CurrentItem

I'm currently researching the above line to see if I can latch onto the
values I need.
Hopefully, it will work as expected and save me a load of money buying 3rd
party work arounds.

Do you know if this is the correct method of retreiving "sent to, from,
subject, body" from a currently selected email?

Sorry for all the questions, I Don't usually do much oOutlook Programming.

Thanks in advance

Dave
 
The CurrentItem property will actually return a different kind of object
depending on the item type (Mail, Contact, Appointment, etc.). So you need
to pass it to an Object variable or evaluate the CurrentItem.Class property
value to determine whether it's a valid object to cast to a typed variable
(like MailItem).

Once you get a MailItem object, access the .To, .Body, .Subject, etc.
properties to get the values you are looking for.

--
Eric Legault - Outlook MVP, MCDBA, MCTS (SharePoint programming, etc.)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/
 
Cheers Eric,

Thanks for all your help.

Dave



Eric Legault said:
The CurrentItem property will actually return a different kind of object
depending on the item type (Mail, Contact, Appointment, etc.). So you need
to pass it to an Object variable or evaluate the CurrentItem.Class property
value to determine whether it's a valid object to cast to a typed variable
(like MailItem).

Once you get a MailItem object, access the .To, .Body, .Subject, etc.
properties to get the values you are looking for.

--
Eric Legault - Outlook MVP, MCDBA, MCTS (SharePoint programming, etc.)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/
 
Back
Top