Google Apps 脚本,Gmail UI 插件,如何删除抄送收件人?

问题描述

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

在 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

有什么想法吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)