Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading Outlook Inbox using Access 97 2

Status
Not open for further replies.

RayProud

Programmer
Nov 10, 2004
18
0
0
GB
Hi,

I'm working on an Access 97 database and one of the requirements is to read the Inbox on the PC where the database is located and to send a reply to the sender. We're using Outlook 98.

I have managed to send a message from Access but I can't work out how to read the Outlook Inbox.

I'm successfully using Outlook.Application and Outlook.MailItem but can't find anything to read a mail item.

Is such a thing possible and if so could some kind soul steer me in the right direction please?
 
Hi Tom,

Thank you very much! I was a bit apprehensive when I saw the code was for 2K and although I didn't have one of the references the one I did have was obviously okay.

A couple of other questions...

1. The code you suggested is reading all messages in the Inbox. I'm only interested in unread items. Is it possible to read only those?

2. After processing I would like to move the message to another folder. Is that possible? I suppose as an alternative I could setup Outlook to archive read messages older than 1 day. Less code! :)

 
Have a look at the UnRead property and the Move method of the MailItem object.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Hi PHV,

I'm checking the UnRead status okay but I'm having a problem with the Move call. I'm getting 'Type Mismatch' on this line

molMail.Move (olFolderDeletedItems)

Do I need to include another Set command similar to the one I have for the Inbox? ...

Set molMAPI = molNameSpace.GetDefaultFolder(olFolderInbox)

Appreciate your help :)
 
Yes, something like this:
Dim myDestFolder As Outlook.MAPIFolder
Set myDestFolder molNameSpace.GetDefaultFolder(olFolderDeletedItems)
...
molMail.Move myDestFolder

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Hi PH,

That did the trick. Thank you very much. Certainly deserving of a star :)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top