Using Admin SDK to update group settings with Apps

2019-08-09 01:33发布

问题:

Keeping it simple - I'm using Google Apps Script Admin SDK Directory Service to bulk create groups:

AdminDirectory.Groups.insert({"email": group1@test.test});

Following this I have been attempting to update the groups permissions using the following:

AdminDirectory.Groups.update({
                             "whoCanJoin": "CAN_REQUEST_TO_JOIN",
                             "whoCanViewMembership": "ALL_IN_DOMAIN_CAN_VIEW",
                             "whoCanViewGroup": "ALL_IN_DOMAIN_CAN_VIEW",
                             "whoCanInvite": "ALL_MANAGERS_CAN_INVITE",
                             "allowExternalMembers": "false",
                             "whoCanPostMessage": "ALL_IN_DOMAIN_CAN_POST",
                             "allowWebPosting": "true"
                             },
                             "group1@test.test");

I've come to the conclusion that what I really need is access to the Group Settings API. Can I do this with Apps Script?

回答1:

Yes, if you can't find what you want from Googles built in services, or the Advanced services, you can always access any other accessible API via the URL fetch service: https://developers.google.com/apps-script/guides/services/external