我们公司最近从Exchange 2007迁移到Google Apps for Business。我们有几个具有相当复杂和广泛的文件夹结构的共享邮箱,并被要求在这些邮箱中全面实施标签技术(以便优化搜索)。优化重新标记代码
例如例如,迁移后,原来在MyCompany/Projects/2012/Q3/Approved Projects/StackOverflow(文件夹结构)中的对话现在具有MyCompany/Projects/2012/Q3/Approved Projects/StackOverflow标签。这个对话将不得不贴上标签MyCompany,Projects,2012,Q3,Approved Projects,StackOverflow。
我已经写了一个脚本来做到这一点(至少在我的测试环境中)。问题是,根据我读过的内容,您可以对Google API执行的呼叫次数有一定限制。而且,脚本执行时间非常非常差。
我想知道是否有办法以某种方式执行操作客户端并批量发送到谷歌API。我已经阅读了缓存服务,并想知道我是否正朝着正确的方向发展。
这是我的脚本:
function addLabels() {
//Get all labels
var allLabels = GmailApp.getUserLabels();
for (var i = 0; i < allLabels.length; i++) {
var label = allLabels[i];//label to get the threads from
var threads = label.getThreads(); //threads assigned with label
var labels = label.getName().split("/");//array of new label names
//add the new labels to the specified threads only if there's a "/" in the label's name
if(label.getName().indexOf("/") != null){
for (var a = 0; a < labels.length; a++){
trace("Adding label '" + labels[a] + "' to "+ threads.length +" threads in '"+ label.getName() + "'.");
//create a new label with the specified name and add it to the threads
//var newLabel = GmailApp.createLabel(labels[a]);//comment this line for test purposes
//newLabel.addToThreads(threads);//comment this line for test purposes
}
}
}
}
function trace(message){
Logger.log(message);
}
提前感谢!