Get folder path where an account stores messages

K

Kamran A

This is my first time developing an add-in for Outlook 2007. I have
successfully been able to retrieve accounts and successfully been able to
retrieve stores.

However, I see no way to correlate the two. My goal is to find what path (or
store) the account is using to store messages in. I see no property on a
store to get an account and see no property to get a store on account.

Is there any way to do this? In the GUI it's easy enough! Is it a rule or
something? How would I find it?

Thanks for any help!
 
K

Ken Slovak - [MVP - Outlook]

An email account doesn't have a mail store associated with it, an Outlook
profile has both accounts and one or more mail stores associated with it.

By default anything you send from any account in a profile ends up in your
default mail store for that profile.

There is a hot fix available that lets the Sent Items folder of a
non-default Exchange mailbox get items sent using the email address for that
non-default Exchange mailbox, instead of the items going to Sent Items in
the default store. That's controlled by a registry setting, but it doesn't
apply to PST files, only to Exchange mailboxes.

You can get the sending address of the item from the
MailItem.SendUsingAccount property. That might help you determine where to
route things if that's your goal.
 
K

Kamran A

Hi Ken, thanks for the information.

My ultimate goal for this add-in is to automatically determine what account
to send from for composing new mail based on the current folder selected.
This is a user experience feature missing from Outlook (that Thunderbird does
automatically).

The only obstacle is getting the mail delivery location associated with an
email account (shown in the GUI). The add-in works fine if I hard code the
path-to-account information, but of course that is not ideal.

The other viable option is to match root folder names with account display
names and that is something I'd like to avoid.

Is there any way to do what I'm talking about?
 
K

Ken Slovak - [MVP - Outlook]

Like I said, an email account is not tied to a store (other than with
Exchange mailboxes). If you have an Exchange mailbox or even a public folder
you can get the email address for that store and if you have permissions you
can send using that account.

If you have POP3 accounts how could those be tied to a store? A PST file can
be opened exclusively by anyone with access to it with no limitations. So I
could open it in one profile that has 3 mail accounts and then in another
profile that has a different 3 accounts. How do you distinguish?

I think your design is fundamentally flawed due to this misunderstanding
about the relationships between mail stores, profiles and email accounts.
All you can do is get the accounts for that profile (Outlook session) and
then guess.
 
K

Ken Slovak - [MVP - Outlook]

But if you have 3 different mailboxes or PST files loaded that will only
tell you what the Accounts collection tells you in Outlook 2007.

It does not tell you which account or accounts are associated with a
particular mail store, if there is any such association at all (there only
is with Exchange mailboxes or public folders). PST files have no email
account association at all.

Also, I can send as Sales or Support or Webmaster or various other email
accounts (mailboxes) in my domain, in addition to my own email address.
Those mailboxes may or may not be loaded in my Outlook session at all.
 

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