在gmail插件中在卡片之间导航

时间:2018-08-27 12:01:29

标签: javascript gmail-api gmail-addons appscript

我正在尝试显示列表,当再次单击一个项目时显示该列表,然后单击列表项目,生成另一张卡并显示一些详细信息。但是我遇到了运行时错误

  

附加组件出错。   运行时错误。   Gmail无法运行此加载项。

 function buildAddOn(e) {
      var cards = [];
      var auth = getToken(); 
      var list = getAllDep(auth);

      if (list.length > 0) {
        list.forEach(function(list){
          //var wfList = getWorkflow(auth,list.id);
          cards.push(buildRecentThreadCard(list.name));
        });
      } else {    
        cards.push(CardService.newCardBuilder().setHeader(CardService.newCardHeader().setTitle('No departments for this user')).build());
      }
      return cards;
    }


    function buildRecentThreadCard(depname){
      var auth = getToken();
      var card = CardService.newCardBuilder();
      card.setHeader(CardService.newCardHeader().setTitle(depname));

      var cards = [];
      var auth = getToken(); 
      var list = getAllDep(auth);

      if (list.length > 0) {
        list.forEach(function(list){
          //var wfList = getWorkflow(auth,list.id);
          cards.push(buildWorkFlowCard(list.name));
        });
      } else {    
        cards.push(CardService.newCardBuilder().setHeader(CardService.newCardHeader().setTitle('No Work Flows for this user')).build());
      }

      return cards;
    }

    function buildWorkFlowCard(depname){
      var auth = getToken();
      var card = CardService.newCardBuilder();
      card.setHeader(CardService.newCardHeader().setTitle(depname));

      var section1 = CardService.newCardSection().setHeader("<font color=\"#1257e0\">workflow</font>");
      section1.addWidget(CardService.newTextParagraph().setText('workflowName'));
      card.addSection(section1);

      return card.build();
    }

0 个答案:

没有答案