Trying to remove Google Groups members gives Not Authorized exception -


i have google apps script attached google sheets document. have following code.

function addgroupmember() {   var useremail = 'aaa@example.com';   var groupemail = 'list@mysite.org';   var member = {     email: useremail,     role: 'member'   };   member = admindirectory.members.insert(member, groupemail); }  function removegroupmember() {   var useremail = 'aaa@example.com';   var groupemail = 'list@mysite.org';   var member = {     email: useremail,     role: 'member'   };   member = admindirectory.members.remove(member, groupemail); } 

the first function works fine add group members. second function delete group members throws exception "not authorized access resource/api". executing administrator user , can edit google groups no problem through admin ui. else need authorized execute script?

as far can tell, followed steps create authorization on notes section here - https://developers.google.com/apps-script/advanced/admin-sdk-directory.

my goal parse emails spreadsheet , use functions add/remove members google groups.

krr provided correct answer in comment. parameters not passed correctly. pasting comment here.

maybe because 'remove' method of members resource takes 'groupkey' , 'memberkey' parameters. method signature is: admindirectory.members.remove(string groupkey, string memberkey). hope helps!


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -