Use the Outlook 2007 Stores collection for that. It returns all opened
stores. The help on that method in the VBA Object Browser has examples of
how to get the default store and how to tell what mailboxes are primary and
secondary mailboxes.
NameSpace.Stores is all the loaded stores, NameSpace.DefaultStore is the
default one. Store.ExchangeStoreType returns olExchangeMailbox,
olExchangePublicFolder, olNotExchange and olPrimaryExchangeMailbox. That
should be exactly what you want.
You can set SendUsingAccount on a MailItem, but if there's only 1 account
(Exchange) that does you no good. So set the SendOnBehalfName property for
sending as another mailbox. For example, if I want to send something as my
sales mailbox I just use that in that property, and as I have SendAs
permissions for that mailbox it goes out from sales. Without SendAs
permissions you get a Sent on Behalf Of header instead of a change of From
address.