Select Mailbox

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
 
K

Ken Slovak - [MVP - Outlook]

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.
 
B

BAC

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
 
K

Ken Slovak - [MVP - Outlook]

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.
 

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