1

我有下面的脚本为我工作......(脚本自动创建一个 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){}
}

我试过这个,但要么我累了,要么我错过了一些愚蠢的东西......?

4

1 回答 1

0

根据本文档,属性的可能值为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"更新为,会导致错误。whoCanPostMessageNONE_CAN_POST
    • 如果archiveOnly从 恢复"true""false",则whoCanPostMessages属性设置为ALL_MANAGERS_CAN_POST

另外,我没有看到任何关于AdminDirectory.Groups.moderation and的参考资料Spammessages。您可能需要查看给出的文档并查看是否messageModerationLevelspamModerationLevel帮助。

于 2017-09-03T14:04:23.857 回答