0

我的第一个问题... :)

在 Gmail UI 插件中,我想删除抄送收件人:

function onGmailCompose(e) {
  var buttonSet = CardService.newButtonSet()
      
      .addButton(CardService.newTextButton().setText('Example Button')
                  .setOnClickAction(CardService.newAction().setFunctionName('ButtonAction'))
                  .setTextButtonStyle(CardService.TextButtonStyle.FILLED));

  var card = CardService.newCardBuilder()
      .setHeader(CardService.newCardHeader().setTitle('Choose...'))
      .addSection(CardService.newCardSection().addWidget(buttonSet));
  
  return card.build();
}

function ButtonAction(e) {
  Logger.log(e);

  var response = CardService.newUpdateDraftActionResponseBuilder()
        .setUpdateDraftCcRecipientsAction(CardService
            //this works fine
            .newUpdateDraftCcRecipientsAction().addUpdateCcRecipients(['jon.doe@example.com']));
            
            //but how to clear CcRecipients?

            //this doesn't work.
            //.newUpdateDraftCcRecipientsAction().addUpdateCcRecipients([]));

            //neither this.
            //.newUpdateDraftCcRecipientsAction().addUpdateCcRecipients());

            //neither this.
            //.newUpdateDraftCcRecipientsAction().addUpdateCcRecipients(['']));

  return response.build();
}

文档没有太大帮助:

https://developers.google.com/apps-script/reference/card-service/update-draft-cc-recipients-action

有任何想法吗?

4

0 回答 0