简体   繁体   中英

Google Tasks in apps script isn't working after 19 Nov 2013

I have an apps script that runs everyday. Its objective is to retrive data from Task, update that task to spreadsheet, then clear that task.

My script used to worked everyday until 19 Nov 2013 (the last day that it runs succesfully is 18 Nov 2013). The script didn't have any change. But I've just found this blog mentioned about code changes required after 19 Nov 2013, but as I read in details it shouldn't affect Task API.

Here is my code snippet that deal with Task

var allTasks = Tasks.Tasks.list(taskListID).getItems();
for(var i in allTasks){
date = Utilities.formatDate(new Date(allTasks[i].getDue()),"GMT+0700","dd/MM/yy");
title = allTasks[i].getTitle();
notes = allTasks[i].getNotes();
data.push([date,title,sum(notes)]);
allTasks[i].setStatus("completed")          
Tasks.Tasks.patch(allTasks[i], taskListID, allTasks[i].getId());
}

When the script runs on 19 Nov 2013 onward, when it runs to

Tasks.Tasks.patch(allTasks[i], taskListID, allTasks[i].getId());

It returns the error "We're sorry, a server error occurred. Please wait a bit and try again."

Is my issue related to the changes mention in the blog? And what can I do to resolve the issue?

Sincerely,

Is it enough to simply clear the completed tasks from the task list in one go, after the loop?

Tasks.Tasks.clear(taskListID);

should do the trick.

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