将电子邮件从一个文件夹移动到另一个

时间:2015-10-08 07:44:30

标签: google-apps-script

我需要将所有电子邮件消息移动到另一个文件夹,其工作正常,但我希望它能够更快完成。消耗的时间超过一分钟,它应该在一分钟内完成。这是我试过的代码

function tkldm() 
{ 
var shruntime = ss.getSheetByName("Test1"); 
var oldlab = GmailApp.getUserLabelByName("Test"); 
var Newlab = GmailApp.getUserLabelByName("Misc");  
var threads = oldlab.getThreads();  
var ThreadCountoldlabel = threads.length;   
var rntimelrow = shruntime.getLastRow(); 
var d = new Date(); 
var timeStamp = d.toTimeString();
shruntime.getRange(rntimelrow+1, 1).setValue(timeStamp);    
for ( var it = 0; it < ThreadCountoldlabel; it++)
{
threads[it].addLabel(Newlab).removeLabel(oldlab).refresh(); 
}  
var d = new Date();
var timeStamp = d.toTimeString();  
shruntime.getRange(rntimelrow+1, 2).setValue(timeStamp);  
}

0 个答案:

没有答案