Using Multiple Accounts for the Same Profile on Outlook
You can log on to Microsoft 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. In other words:
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 there is one account or multiple accounts in the session's profile.
Use the following members of the NameSpace object if there is only the primary Exchange account in the session's profile. |
Purpose |
Use the following members of the noted objects if there are multiple accounts in the session's profile. |
Purpose |
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. |
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. |
See the following tasks if you are operating with multiple accounts in the current profile: