private String generateTable(WBTeam team, String groupName, String groupType, String title, List <String> groupEmails) { string html = ""; SPServiceContext serviceContext = SPServiceContext.GetContext(SPContext.Current.Site); UserProfileManager profileManager = new UserProfileManager(serviceContext); SPGroup group = SPContext.Current.Site.RootWeb.WBxGetGroupOrNull(groupName); if (group == null) { // Then either the owners group name has not been defined for this team, or the group doesn’t exist for some reason! html += "<i>(The " + groupType + " group name has not been defined for this team, or the group doesn’t exist for some reason)</i>"; } else { // If the current user is not allowed to see the members then we'll return blank: if (group.OnlyAllowMembersViewMembership && !group.ContainsCurrentUser) { return(""); } html += "<h3>" + title + ":</h3>\n"; // OK so now we have the SPGroup for the team’s owners group. // Now we can iterate through the SPUser-s in this group … or whatever else we want to do with it, e.g.: html += "<table cellpadding='5'><tr><td><ul>"; foreach (SPUser user in group.Users) { html += "<li>" + user.WBxToHTML(profileManager); //renderUser(user, SPContext.Current.Site.RootWeb); if (team.IsUserTeamManager(user)) { html += " (manager)"; } else { if (userIsTeamOwnerOrSystemAdmin) { string actionURL = "RemoveFromTeam.aspx?userLogin="******"\\", "\\\\") + "&role=" + groupType; html += " <a href=\"javascript: WorkBoxFramework_relativeCommandAction('" + actionURL + "', 0, 0); \">(remove)</a>"; } } html += "</li>"; if (profileManager.UserExists(user.LoginName) && !String.IsNullOrEmpty(user.Email) && !groupEmails.Contains(user.Email)) { groupEmails.Add(user.Email); } } html += "</ul></td></tr>\n"; html += "</table>\n"; } return(html); }