Reputation: 37
I wrote a simple apps script that reads users from a sheet and then adds them to one or more default groups in my organization
I'd like to set their Post properties to Not allowed - those groups must be read only for end users
can't find on G Suite Reference the right way - if existing...
this is the snippet of code I'm using to add users to groups:
function addGroupMember(user, group) {
var member = {
email: user,
role: 'MEMBER'
};
member = AdminDirectory.Members.insert(member, group);
}
thank you in advance
Upvotes: 0
Views: 483
Reputation: 6481
In the group settings in admin.google.com you will find:
Which represents all the permissions. At first, it is quite open. In your case the key is to differentiate the permissions of Group Managers and Group Members. Then all you need to do is to change which permission each member has.
As you have seen, to use the Admin API from Apps Script you can install the Admin SDK Directory service from Apps Script.
Admin SDK Directory service uses the same objects, methods, and parameters as the public API.
This excerpt is from Admin Advanced Service main page. This means that all you need to do is to find a request that works in the Admin API, and then translate it over to Apps Script.
These resources would be helpful for finding a request that works for updating group permissions and also changing the permissions of members within that group to be Managers or just Members with read-only access:
Upvotes: 0