473,662 Members | 2,588 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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 objEmbeddedMess age As MAPI.Message

Dim objNewMail As MAPI.Message

If cboFileType.Sel ectedIndex <-1 Then

ListBox1.Items. Clear()

'create session and logon

objSession = CreateObject("M API.Session")

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

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

' objSession.Logo n()

'reference the messages in the inbox

objInbox = objSession.Inbo x

objMessages = objInbox.Messag es

--
Bill Bray
Mar 9 '08 #1
2 4588
at www.freevbcode.com they have some more examples..

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

for each objInbox in objSession.Fold ers
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

On Mar 8, 9:52*pm, "bill" <b...@bottlegar den.comwrote:
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 objEmbeddedMess age As MAPI.Message

Dim objNewMail As MAPI.Message

If cboFileType.Sel ectedIndex <-1 Then

ListBox1.Items. Clear()

'create session and logon

objSession = CreateObject("M API.Session")

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

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

' objSession.Logo n()

'reference the messages in the inbox

objInbox = objSession.Inbo x

objMessages = objInbox.Messag es

--
Bill Bray
Mar 10 '08 #2
Thank you I will give that a shot!

<aa*********@gm ail.comwrote in message
news:f3******** *************** ***********@u10 g2000prn.google groups.com...
at www.freevbcode.com they have some more examples..

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

for each objInbox in objSession.Fold ers
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

On Mar 8, 9:52 pm, "bill" <b...@bottlegar den.comwrote:
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 objEmbeddedMess age As MAPI.Message

Dim objNewMail As MAPI.Message

If cboFileType.Sel ectedIndex <-1 Then

ListBox1.Items. Clear()

'create session and logon

objSession = CreateObject("M API.Session")

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

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

' objSession.Logo n()

'reference the messages in the inbox

objInbox = objSession.Inbo x

objMessages = objInbox.Messag es

--
Bill Bray

Mar 11 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2269
by: Jason Ferree | last post by:
I posetd this in one group, but got no response, so I'll try it in this one. I am trying to loop through all messages in the inbox. To do something, in my case, look for and save attachments. It is telling me that items is not a collection. I've tried everything I can think of, I've even copied the code from a few sources (had to add specific OOM in front of method names), Including Sues book, some code from www.outlookcode.com, and...
0
1383
by: Keith | last post by:
A2k, Win XP Pro. I'm trying to follow this example in the MSKB: http://support.microsoft.com/default.aspx?scid=kb;en-us;209946&Product=acc2000 When I run the code I get the error "Error 3710 MAPI folder or address book not found." I suspect that I'm substituting wrong data for the Exchange Mailbox - am I right in thinking that I should be using what's in Outlook's Tools/Accounts/Properties/"Mail Account" (the top box)?
5
1687
by: Bob Dydd | last post by:
Hi Everybody I have an Access 2000 MDB with the Usual FrontEnd/BackEnd Arrangement. The program depends on being able link to "Inbox" in Ms Outlook 2000. This is easy enough to do from the FrontEnd and has been OK while me and the missus have been using the program ourselves. Now We want to be able to give the program to others who mainly do not have MS Access installed., or if they do, have no idea what it is
2
2042
by: Mikedi | last post by:
Hi. I use Exchange Server and I need to create a lot of rules to control my incomming mail. I also need be able to check my mailbox from any PC connected to the net. However there is only 32Kb of space reserved for rules on each inbox folder, which is insufficient. I have searched the web for at solution, and it seems that I have to create additional folders, and move/copy my Inbox rules to them + make a forwarding rule that checks all...
1
4333
by: Roger | last post by:
I currently have an application that can monitor the Inbox of one mailbox running on a client using Outlook 2003. This is a standalone application that needs Outlook to be running in order to see all mail coming into the e-mail box. This is using Interop.Outlook Example of code... Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
2
5360
by: Jason Ferree | last post by:
I am trying to loop through all messages in the inbox. To do something, in my case, look for and save attachments. It is telling me that items is not a collection. I've tried everything I can think of, I've even copied the code from a few sources (had to add specific OOM in front of method names), Including Sues book, some code from www.outlookcode.com, and one other place. but other than that, no change to copied code. I think the...
1
2165
by: tom north | last post by:
What I am after would be a VB script perhaps using CDO to access the inbox of a mailbox, and push or pull messages in or out to a flat file directory on disk -- Tom North
0
1781
by: Chicka | last post by:
I need/want to be able to send an email from a website running IIS and CDONTS for mail (or ASPMAIL) that comes into the inbox as an appointment to be accepted. The company is not running Exchange internally or on the website (which is hosted). Here is the basic app: A visitor schedules an appointment to speak to a rep from the company. Their appointment data is kept in a SQL DB.
4
6444
by: infomage27 | last post by:
I have tried scripting this with rules and VBA, now trying with C# but still failing. (code is exploratory, so please excuse the terribleness) maybe someone here will show me the error of my code... sending an email by hand - everything works as expected (rules, VBA, etc are all applied). sending an email from code (C#, external VBA, etc) has the messages saving in Sent Items regardless of any other settings or configurations (up to...
0
8432
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8344
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8857
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8546
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8633
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7367
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5654
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4347
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1752
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.