Using Multiple Accounts for the Same Profile on Outlook
You can sign in to Outlook by using a profile that specifies one or more accounts associated with different delivery stores. For a given session, the NameSpace object has members that maintain and access information for the primary Exchange account, and the Accounts property of the NameSpace object holds information for all the accounts defined for the session's profile.
The NameSpace.Accounts property returns an Accounts collection for the current profile, tracking information for all accounts including Exchange, IMAP, and POP3 accounts, each of which can be associated with a different delivery store. To identify the primary Exchange account in the Accounts collection for a session, look for the account that has the ExchangeStoreType property of the store (that is specified by Account.DeliveryStore) equal to OlExchangeStoreType.olPrimaryExchangeMailbox.
Account.DeliveryStore.ExchangeStoreType = OlExchangeStoreType.olPrimaryExchangeMailbox
The following table compares members of the NameSpace object and members of the Account, Accounts, or Store object depending on whether the session's profile has one account or multiple accounts. If only the primary Exchange account is in the session's profile, use the following members of the NameSpace object.
Description | Purpose |
---|---|
Use the following members of the noted objects if there are multiple accounts in the session's profile. | AutoDiscoverConnectionMode property, AutoDiscoverXml property, AutoDiscoverComplete event |
To use auto discovery of the Exchange server that hosts the primary Exchange account mailbox. | Account.AutoDiscoverConnectionMode property, Account.AutoDiscoverXml property, Accounts.AutoDiscoverComplete event |
To use auto discovery of the Exchange server that hosts the account mailbox. | ExchangeConnectionMode property, ExchangeMailboxServerName property, ExchangeMailboxServerVersion property |
To obtain information for the Exchange server that hosts the primary Exchange account mailbox. | Account.ExchangeConnectionMode property, Account.ExchangeMailboxServerName property, Account.ExchangeMailboxServerVersion property |
To obtain information for the Exchange server that hosts the account mailbox. | Categories property |
To obtain a Categories collection that represents the Master Category List for the primary account of the session. | Store.Categories property |
To obtain a Categories collection that represents the categories defined for the store that is associated with an account in the session's profile. | CurrentUser property |
To obtain a Recipient object that represents the user currently logged on for the session. | Account.CurrentUser property |
To obtain a Recipient object that represents the user of the account that is defined in the session's profile. The account can be any account that Outlook supports including Exchange, IMAP, and POP3. | DefaultStore property |
To obtain the default store for the session's profile. | Account.DeliveryStore property |
To obtain the default delivery store for the account that is defined in the session's profile. The account can be any account that Outlook supports including Exchange, IMAP, and POP3. | GetAddressEntryFromID method |
To obtain an AddressEntry object that corresponds to the given entry ID. | Account.GetAddressEntryFromID method |
To obtain an AddressEntry object that corresponds to the account and given entry ID. The account can be any account that Outlook supports including Exchange, IMAP, and POP3. | GetRecipientFromID method |
To obtain a Recipient object that corresponds to the given entry ID. | Account.GetRecipientFromID method |
To obtain a Recipient object that corresponds to the account and given entry ID. | The account can be any account that Outlook supports including Exchange, IMAP, and POP3. |
If you are operating with multiple accounts in the current profile, see the following tasks:
How to: Create a Sendable Item for a Specific Account Based on the Current Folder
How to: Identify a Global Address List or a Set of Address Lists with a Store
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.