retrieving the default outlook email account using Redemption

和自甴很熟 提交于 2019-12-11 23:31:52

问题


just trying to work my way around using Redemption; I've got the following code to retrieve the RDOAccounts (Email accounts) from the default Profile:

Profiles profiles = (Profiles)Activator.CreateInstance(Type.GetTypeFromProgID("ProfMan.Profiles"));
Profile defaultProfile = profiles.DefaultProfile;           
//open a RDOSession for this profile
RDOSession session = RedemptionLoader.new_RDOSession();
session.Logon(defaultProfile.Name);
RDOAccounts accounts = session.Accounts;

Where I'm stuck is trying to determine which of the RDOAccount objects is set as the default email account - there doesn't seem to be any property on the object that I can use to see whether it's the default or not.

Anyone done this before?


回答1:


Use RDOSession.Accounts collection, in particular RDOAccounts.GetOrder method: http://www.dimastr.com/redemption/RDOAccounts.htm




回答2:


I think this works - but if anyone's got a more elegant solution I'd love to hear it!

RDOAccount defaultAccount = session.GetDefaultFolder(rdoDefaultFolders.olFolderInbox).Store.StoreAccount;            


来源:https://stackoverflow.com/questions/9781913/retrieving-the-default-outlook-email-account-using-redemption

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!