简体   繁体   中英

can i call time based trigger on gmail add-ons?

I am creating gmail add-ons. Is there any way to call a time based trigger per user when a user installs add-ons?

function getMail(){
  var interval = 5;   
  var date = new Date();
  var timeFrom = Math.floor(date.valueOf()/1000) - 60 * interval;
  var threads = GmailApp.search('is:inbox after:' + timeFrom);
  var emailAddress = Gmail.Users.getProfile("me").emailAddress;
  for (var i = 0; i < threads.length; i++)
 {
    var data=Gmail.Users.Messages.get(emailAddress,threads[i].getId(), 
    {format: "RAW"}).raw;
    var signature =Utilities.newBlob(data).getDataAsString();
     Logger.log(signature);
}
  }
function trigger(){
  ScriptApp.newTrigger("getMail").timeBased().everyMinutes(1).create();

}

function onInstall(e){
  trigger();
}

The answer is no. They do not allow the creation of triggers from the gmail add on. Further information can be found here at the restrictions page.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM