How to refrence the inbox of an additional mailbox in Outlook?

B

bill

I have this code to get to the default Outlook inbox but I would like to get
to the inbox of an additional added mailbox. Can this be done? Here is the
code I'm using below:
Dim objSession As MAPI.Session

Dim objInbox As MAPI.Folder

Dim objMessages As MAPI.Messages

Dim objMessage As MAPI.Message

Dim objEmbeddedMessage As MAPI.Message

Dim objNewMail As MAPI.Message

If cboFileType.SelectedIndex <> -1 Then

ListBox1.Items.Clear()

'create session and logon

objSession = CreateObject("MAPI.Session")

'Use this for non exchange outlook - objSession.Logon("Outlook")

objSession.Logon("Default Outlook Profile") 'works on Halliburton COE

' objSession.Logon()

'reference the messages in the inbox

objInbox = objSession.Inbox

objMessages = objInbox.Messages
 
A

aaron.kempf

at www.freevbcode.com they have some more examples..

I just know that in one of these methods you can rewrite
objInbox = objSession.Inbox

for each objInbox in objSession.Folders
Msgbox objInbox.Name
End if

It should be something like that; just iterate through the folders
until you see the folder name you want.. I am pretty sure that should
help, but YMMV

-Aaron
 
B

bill

Thank you I will give that a shot!

at www.freevbcode.com they have some more examples..

I just know that in one of these methods you can rewrite
objInbox = objSession.Inbox

for each objInbox in objSession.Folders
Msgbox objInbox.Name
End if

It should be something like that; just iterate through the folders
until you see the folder name you want.. I am pretty sure that should
help, but YMMV

-Aaron
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top