2

I have a Google form, from which I want to add the Email field into a Google group. Currently, the form responses are recorded in a spreadsheet (on Google drive) and also, an automatic response is sent to their email id acknowledging their registration. I also need to add that email id into a Google group as a member.

I tried this, but it did not work:

function addMember(f) {
  var email = "";
  for (var field in f.namedValues) {
    if (field == 'Email Address') {
      email = f.namedValues[field].toString();
    }
  }
  var options = {
    "email": email,
    "role": "MEMBER"
  };
  var result = UrlFetchApp.fetch("googleapis.com/admin/directory/v1/groups/…", options);
}
Mogsdad
  • 44,709
  • 21
  • 151
  • 275
samvrit
  • 21
  • 3
  • Is this a duplicate question:http://stackoverflow.com/questions/21253849/google-groups-api-add-member?rq=1 – eddyparkinson Jul 16 '14 at 07:32
  • @eddyparkinson might be duplicate - but we can't be sure they're using the groups api or apps script. Either way, samvrit, you need to add more information to make this question answerable. Best if you can provide some code, but at least share what you have tried so far. – Mogsdad Jul 18 '14 at 11:53
  • I tried this: function addMember(f) { var email = ""; for(var field in f.namedValues) { if (field == 'Email Address') { email = f.namedValues[field].toString(); } } var options = { "email" : email, "role" : "MEMBER" }; var result = UrlFetchApp.fetch("https://www.googleapis.com/admin/directory/v1/groups/alumni-process-management/members", options); } but did not work – samvrit Jul 19 '14 at 11:56

0 Answers0