问题
Is it possible to get list of all existing accounts from Outlook 2003 using only standard COM? It means I can't use Redemption library, but only default Outlook 2003 object model . It's much easy to get accounts at Outlook 2007/2010:
dynamic outlook = AutomationFactory.GetObject("Outlook.Application");
var accounts = outlook.Session.Accounts;
But there is no "Accounts" property for Outlook 2003. By default I can access only default account using "CurrentUser" property. So maybe is there some another way to obtain all accounts (using ONLY Outlook 2003 object model)?
回答1:
The Accounts property is not available in the Outlook 2003 object model. One way to get this information is to use Extended MAPI (MAPI 1.0), and the EnumerateAccounts method of the IOlkAccountManager interface. However, using Extendend MAPI from manage code is discouraged. There are third party wrappers available, a pouplar one being Redemption. Below are a few resources that will be helpful.
http://support.microsoft.com/kb/200018
http://www.codeproject.com/KB/IP/CMapiEx.aspx
http://www.codeproject.com/KB/office/BridgingTheGap.aspx
回答2:
I've finally found answer. I'm not using object model, but I do exactly same as Redemption (read registry). So it's acceptable answer as for me.
来源:https://stackoverflow.com/questions/3184579/how-to-get-outlook-2003-accounts-list-using-outlook-2003-object-model