Select Mailbox

  • Thread starter Thread starter BAC
  • Start date Start date
B

BAC

I have several mailboxes, including multiple shared mailboxes that each have
their own collection of folders(Inbox, Saved Items etc.)

I've found lots of examples on how to select specific folders using VBA,
but how do I select which mailbox I want so I can be sure I'm looking in the
correct InBox?

My requirement is to look for new incoming items in one shared mailbox, then
move them to other folders within other shared mailboxes. I can't figure out
how to select the relevant mailboxes?

TIA
 
The NameSpace.Folders collection has all of your open mail stores. Of course
with PST files most or all will be called "Personal Folders" unless they are
explicitly named something else.
 
Thanks for the quick response, Ken, but my problem is that using the
NewMailEx event in a sub only seems to act on my Default Inbox (the mailbox
-bruce.a.caouette). My routine is working when I send e-mails there
I need to force the NewMailEX event to be triggered on new mail coming into
another mailbox (mailbox-Bal AP Req) to automate a data collection process.
Using the PickFolder method requires user intervention => Not really
automated and SelectFolder doesn't allow me to specify the folder mailbox-Bal
AP Req

TIA
 
NewMail and NewMailEx both will only fire in the default mail store. Handle
the Inbox.Items.ItemAdd event for that other mailbox's Inbox folder.

That may not work unless you add that other mailbox in your Outlook profile
settings. It might not work if the folder is opened using the UI. So you
should add that mailbox to your profile so it's opened when you open
Outlook, get the Inbox using NameSpace.GetSharedDefaultFolder() and then add
an ItemAdd handler for the Items collection of that folder.
 
Back
Top