public MailAccount[] GetAccounts(string domainName) { try { svcUserAdmin users = new svcUserAdmin(); PrepareProxy(users); UserInfoListResult result = users.GetUsers(AdminUsername, AdminPassword, domainName); if (!result.Result) throw new Exception(result.Message); List<MailAccount> accounts = new List<MailAccount>(); foreach (UserInfo user in result.Users) { if (user.IsDomainAdmin && !ImportDomainAdmin) continue; MailAccount account = new MailAccount(); account.Name = user.UserName; account.Password = user.Password; accounts.Add(account); } return accounts.ToArray(); } catch (Exception ex) { throw new Exception("Could not get the list of domain mailboxes", ex); } }