Created
February 7, 2017 17:20
-
-
Save LewisLebentz/1f5738347532ed32a2380cada54745ea to your computer and use it in GitHub Desktop.
Google Apps Script to find all members in a group
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function doGet(e){ | |
var input = e.parameter.email; | |
Logger.log(input); | |
if (input == "") | |
{ | |
return HtmlService.createHtmlOutput("<h2>fail</h2>") | |
} | |
return HtmlService.createHtmlOutput(listGroupMembers(input)) | |
}; | |
function listGroupMembers(input) { | |
var group = GroupsApp.getGroupByEmail(input); | |
var s = "<div align='center'><font color='fa0029' family='ubuntu'><br><br><b>" + group.getEmail() + '</b><br><br>'; | |
var users = group.getUsers(); | |
for (var i = 0; i < users.length; i++) { | |
var user = users[i]; | |
s = s + user.getEmail() + "<br> "; | |
} | |
s = s + "<br><br><b>Total Users: " + users.length; | |
s = s + "<br><button onclick='goBack()'>Go Back</button><script>function goBack() {window.history.back()}</script>"; | |
Logger.log(s); | |
return s; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment