我有以下脚本为我工作....(脚本自动创建一个谷歌组,其中包含来自电子表格的数据,该电子表格会自动填充表单中的数据...)
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){}
}
有人可以帮助我完成它,因为我无法工作的其余步骤是:
将组审核设置设置为:跳过审核队列并将邮件发布到组
将过帐权限设置为:public
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){}
}
我试过这个,但要么我累了还是我错过了一些愚蠢的东西......?
答案 0 :(得分:0)
根据此documentation,whoCanPostMessage
属性的可能值为:
ALL_IN_DOMAIN_CAN_POST
- 帐户中的任何人都可以发帖子。ALL_MANAGERS_CAN_POST
- 管理员(包括群组所有者)可以发布消息。ALL_MEMBERS_CAN_POST
- 任何群组成员都可以发帖子。ANYONE_CAN_POST
- 您帐户外的所有Google Apps用户都可以访问您的Google网上论坛服务并发布消息。whoCanPostMessage
设置为ANYONE_CAN_POST
时,我们建议将messageModerationLevel
属性设置为MODERATE_NON_MEMBERS
,以保护群组免受可能的垃圾邮件攻击。 NONE_CAN_POST
- 该组已被停用并存档。没有人可以向此群组发送消息。
archiveOnly value="false"
将whoCanPostMessage
属性更新为NONE_CAN_POST
时,会导致错误。archiveOnly
从"true"
还原为"false"
,则whoCanPostMessages
属性设置为ALL_MANAGERS_CAN_POST
。另外,我没有看到有关AdminDirectory.Groups.moderation
和Spammessages
的任何引用。您可能需要查看给出的文档,看看messageModerationLevel
和spamModerationLevel
是否有帮助。