我有下面的脚本为我工作......(脚本自动创建一个 google 组,其中包含来自电子表格的数据,该电子表格中的数据自动填充来自表单的数据......)
function onFormSubmit() {
var sheet = SpreadsheetApp.openById("17KZXpWHipISZSqgD9w255VrirzITrks0fLaBpXp7Ybk")
var email = sheet.getRange("B"+sheet.getLastRow()).getValue()
var name = sheet.getRange("C"+sheet.getLastRow()).getValue()
var user = sheet.getRange("AH"+sheet.getLastRow()).getValue()
try{
AdminDirectory.Groups.insert(
{
"email": email,
"name": name,
}
)
AdminDirectory.Members.insert(
{
"email": user,
"role": "OWNER",
}
, email)
GmailApp.sendEmail("Manager@test.co.uk",email + " Group creation | Success", " address has been created for " + name)
} catch(e){}
}
有人可以帮我完成它,因为我无法工作的剩余步骤是:
将群组审核设置设置为:跳过审核队列并将消息发布到群组
将发帖权限设置为:公开
function onFormSubmit() {
var sheet = SpreadsheetApp.openById("17KZXpWHipISZSqgD9w255VrirzITrks0fLaBpXp7Ybk")
var email = sheet.getRange("B"+sheet.getLastRow()).getValue()
var name = sheet.getRange("C"+sheet.getLastRow()).getValue()
var user = sheet.getRange("AH"+sheet.getLastRow()).getValue()
try{
AdminDirectory.Groups.insert(
{
"email": email,
"name": name,
}
)
AdminDirectory.Members.insert(
{
"email": user,
"role": "OWNER",
}
)
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": "PUBLIC",
}
)
AdminDirectory.Groups.moderation(
{
"Spammessages": "Skip_the_moderation_queue_and_post_to_the_group"
}
, email)
GmailApp.sendEmail("r.hershey@onemotion.co.uk",email + " Group creation | Success", " address has been created for " + name)
} catch(e){}
}
我试过这个,但要么我累了,要么我错过了一些愚蠢的东西......?