public MailGroup[] GetGroups(string domainName) { List <MailGroup> groups = new List <MailGroup>(); Tree config = AMSHelper.GetUsersConfig(); AmsMailbox[] amsGroups = AmsMailbox.GetMailGroups(config, domainName); foreach (AmsMailbox amsGroup in amsGroups) { groups.Add(amsGroup.ToMailGroup()); } return(groups.ToArray()); }