Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google apps script 谷歌脚本访问联系人';s电子邮件地址的自定义标签_Google Apps Script_Gmail_Google Contacts Api_Gmail Contextual Gadgets - Fatal编程技术网

Google apps script 谷歌脚本访问联系人';s电子邮件地址的自定义标签

Google apps script 谷歌脚本访问联系人';s电子邮件地址的自定义标签,google-apps-script,gmail,google-contacts-api,gmail-contextual-gadgets,Google Apps Script,Gmail,Google Contacts Api,Gmail Contextual Gadgets,(谷歌新脚本{大约2周},请详细说明) 我已经尝试了所有我能找到或想到的方法来显示联系人电子邮件地址列表的自定义标签。这是非常令人沮丧的。当我搜索时,我得到了很多关于gmail邮件标签的点击率,但是对于个人联系人中的电子邮件地址的自定义标签却一无所获 长期目标是为我儿子的童子军部队建立一个汽车转运站,并采取初步的步骤到达那里 有些男孩希望收到短信通知,有些男孩希望收到电子邮件通知。因为有些人有实际的电子邮件(与附件一起使用)和手机(用于提醒),所以需要定制联系人电子邮件标签。我可以列出所有联系人

(谷歌新脚本{大约2周},请详细说明)

我已经尝试了所有我能找到或想到的方法来显示联系人电子邮件地址列表的自定义标签。这是非常令人沮丧的。当我搜索时,我得到了很多关于gmail邮件标签的点击率,但是对于个人联系人中的电子邮件地址的自定义标签却一无所获

长期目标是为我儿子的童子军部队建立一个汽车转运站,并采取初步的步骤到达那里

有些男孩希望收到短信通知,有些男孩希望收到电子邮件通知。因为有些人有实际的电子邮件(与附件一起使用)和手机(用于提醒),所以需要定制联系人电子邮件标签。我可以列出所有联系人组,也可以列出每个组中的所有联系人姓名。我甚至可以得到每个联系人的所有电子邮件地址。但我无法获得联系人电子邮件列表的自定义标签

我无法理解为什么“getLabel”方法不执行所有“幕后”工作并返回标签文本,而不管标签类型(自定义或内置)

任何指导都将不胜感激

    function Get_Groups_Contacts(GroupList) 
    {
      var groups = ContactsApp.getContactGroups();  //get the list of groups
      for (var i in groups)  //for each item in the group list ...
      {
        for (var n=0; n<=15; n++)  //need to setup retries since the next part sometimes has server issues
        {
          try  //trap errors
          { 
            var cont = groups[i].getContacts()  //get the list of contacts that belong to the group
            var arrCont= []  //define the temp storage
            for (var j in cont)  //step through each contact
            {
    //I can store a list of contact names…
              arrCont.push(cont[j].getFullName() );  //get the contact's full name
    // but am trying to switch to specific email address….
              var eml = cont[j].getEmails();  // the list of all email address for a contact
    //now the messy part, trying to figure things out
    //lists the built in labels but not the custom labels
              for (k in eml) Logger.log(typeof eml[k].getLabel() + "??" + eml[k].getLabel() + "--" + eml[k].getAddress());
              for (k in eml)
              {
                try 
                {
                  var x = eml[k].getLabel();
                  Logger.log(k + " !!" + typeof x + "??" + x + "--" + eml[k].getAddress() + "**" + "hello");
    //              var oneeml = eml[k];
                  var oneeml = cont[j].getEmails("Other");
                  Logger.log("xxxxxxxxxxxxxxxxxxxxxxxx");
                  Logger.log("oneeml " + oneeml);
                  //Logger.log(oneeml.getLabel())
                  Logger.log("zzzzzzzzzzzzzzzzzzzzzzzz");
                  for (zz in oneeml) Logger.log(oneeml[zz]);
                  for (zz in oneeml) 
                    if (zz == "setAsPrimary") Logger.log(zz)
                    else if (zz == "setDisplayName") Logger.log(zz)
                    else if (zz == "setAddress") Logger.log(zz)
                    else if (zz == "setLabel") Logger.log(zz)
                    else if (zz == "deleteEmailField") Logger.log(zz)
                    else Logger.log(oneeml[zz]())
                    ;
                }
                catch(ext)
                {
                  Logger.log("inner catch");
                  Logger.log(ext.message);
                }
              }
            } 
    //end of the messy part
            GroupList[groups[i].getGroupName()] = arrCont  //store the list in the property
            break;  //go on to the next group
          }  //end of try
          catch(err)  //catch the error here
          {
    //        Logger.log (n + " error message" + err.message);  //debug
           Logger.log ("n=" + n);  //debug
            sleep((Math.pow(2,n) + (Math.random(0, 1000) / 100)) );  //increasing random sleep time waiting for the server
          }  //end of catch
          finally  //always do this part
          {
            cont = undefined;  //cleanup
            arrCont = undefined;  //cleanup
          }  //end of error traping
        }  //end of retry loop
      }  //end for each group item
    };  //end of function List_Groups_Contacts()
函数获取群组联系人(群组列表)
{
var groups=ContactsApp.getContactGroups();//获取组列表
for(组中的变量i)//对于组列表中的每个项。。。
{
对于(var n=0;n