/// <summary> /// check if RdoAccount is email account /// Notes: AccountCategories is a combination of the rdoAccountCategory enums (acStore = 1, acMail = 2, acAddressBook = 4). /// </summary> /// <param name="rdoAccount"></param> /// <returns></returns> private static bool IsEmailAccountCategory(RDOAccount rdoAccount) { return (rdoAccount.AccountCategories & EmailAccountCategoryFlag) != 0; }
private void AppendRdoAccountInformation(RDOAccount rdoAccount, StringBuilder resultText, bool emailAcctOnly, int accountNumber) { if (emailAcctOnly) { if (!IsEmailAccountCategory(rdoAccount)) { return; } } resultText.AppendLine(string.Format("** {0} Email Account: {1}, Type = {2}, Category = {3}", accountNumber, rdoAccount.Name, rdoAccount.AccountTypeStr, rdoAccount.AccountCategories.ToString())); switch (rdoAccount.AccountType) { case rdoAccountType.atPOP3: { resultText.AppendLine(string.Format(" ----- Pop3 account, SMTPAddress = {0}, ", ((IRDOPOP3Account)rdoAccount).SMTPAddress)); break; } case rdoAccountType.atHTTP: { resultText.AppendLine(string.Format(" ----- HTTPAccount account, SMTPAddress = {0}, ", ((RDOHTTPAccount)rdoAccount).SMTPAddress)); break; } case rdoAccountType.atIMAP: { resultText.AppendLine(string.Format(" ----- atIMAP account, SMTPAddress = {0}, ", ((RDOIMAPAccount)rdoAccount).SMTPAddress)); break; } case rdoAccountType.atExchange: { foreach (RDOStore store in RdoSession.Stores) { try { if (store.StoreKind == TxStoreKind.skPrimaryExchangeMailbox) { RDOExchangeMailboxStore exStore = (RDOExchangeMailboxStore)store; resultText.AppendLine("----- atExchange account, SMTPAddress" + exStore.Owner.SMTPAddress); } } catch (Exception ex) { //resultText.AppendLine(ex.Message); } } //RDOMAPIAccount acct = rdoAccount as RDOMAPIAccount; //var isExchange = acct.IsExchange; //var x1 = acct.ServiceName; //var x2 = acct.ServiceUID; //var x3 = acct.Name; //var x4 = acct.ID; //var x5 = acct.Stamp; //resultText.AppendLine(string.Format(" ----- atExchange account, SMTPAddress = {0}, ", ((RDOIMAPAccount)rdoAccount).SMTPAddress)); break; } case rdoAccountType.atMAPI: { resultText.AppendLine(string.Format(" ----- MAPI account, Service Name = {0}, Name = {1}", ((RDOMAPIAccount)rdoAccount).ServiceName, ((RDOMAPIAccount)rdoAccount).Name)); break; } default: { resultText.AppendLine(string.Format(" ----- Account Type account = {0}, ", rdoAccount.AccountType.ToString())); break; } } resultText.AppendLine(" "); }
public string GetEmailAddressForAccount(RDOAccount rdoAccount) { string accountEmailAddress = null; switch (rdoAccount.AccountType) { case rdoAccountType.atPOP3: { accountEmailAddress = ((IRDOPOP3Account)rdoAccount).SMTPAddress; break; } case rdoAccountType.atHTTP: { accountEmailAddress = ((RDOHTTPAccount)rdoAccount).SMTPAddress; break; } case rdoAccountType.atIMAP: { accountEmailAddress = ((RDOIMAPAccount)rdoAccount).SMTPAddress; break; } } return accountEmailAddress; }