Read Outlook mail (not inbox) from Access 2007

ino_mart

Registered User.
Local time
Today, 14:47
Joined
Oct 7, 2009
Messages
78
All

I need to import Outlook email in an Access 2007-database.

I found code how to read mails stored in the Inbox
Set golApp = Outlook.Application
Set gnspNameSpace = golApp.GetNamespace("mapi")
Set mapifolder = gnspNameSpace.GetDefaultFolder(olFolderInbox)
For Each item In mapifolder.Items
MsgBox item.Subject
Next

Problem is that my mails are not stored in the Inbox. They are stored in a folder "Export" which I have created manually in my Outlook mailbox.

How can I access a non-default Outlook folder and retrieve its content?

Kind regards
Ino
 
Hi

Try this:
Set mapifolder = gnspNameSpace.Folders("Export")

For sub folders:
Set mapifolder = gnspNameSpace.Folders("Export").Folders("Export sub folder")

hth
Chris
 
Chris

This results in error

Run-time error '-2147221233 (8004010f)':
The operation failed. An object could not be found.

My mailbox is connected with a MS Exchange mailserver

Regards
Ino
 
I found the solution by adding the name of my mailbox

Set mapifolder = gnspNameSpace.Folders("Mailbox - Ino").Folders("Export")
 

Users who are viewing this thread

Back
Top Bottom