Difference between revisions of "Send All Google Tasks in a Task List to Google GMail"
Jump to navigation
Jump to search
(Created page with "<pre> // Constant TASKLIST = "Ittichai's list"; // ----------------------------------------------------- function getTasklistId_(tasklistName) { var tasklistsList =...") |
|||
(5 intermediate revisions by the same user not shown) | |||
Line 18: | Line 18: | ||
function main() { | function main() { | ||
− | //Get the task | + | // Get the task ID defined in TASKLIST |
var tasklistid = getTasklistId_(TASKLIST) | var tasklistid = getTasklistId_(TASKLIST) | ||
+ | |||
+ | // Get all tasks in the task list | ||
var tasks = Tasks.Tasks.list(tasklistid).getItems(); | var tasks = Tasks.Tasks.list(tasklistid).getItems(); | ||
− | + | ||
for(var i in tasks){ | for(var i in tasks){ | ||
var tasktitle = tasks[i].getTitle(); | var tasktitle = tasks[i].getTitle(); | ||
− | + | var tasknotes = tasks[i].getNotes(); | |
− | + | MailApp.sendEmail('ittichai@gmail.com', tasktitle, tasknotes); | |
− | + | ||
− | + | } | |
− | |||
} | } | ||
− | + | ||
+ | </pre> | ||
+ | |||
+ | * See this note to understand what needs to be done to run this script - http://ittichaicham.com/wiki/Create_Google_Tasks_by_sending_email_to_Google_GMail | ||
+ | |||
+ | [[Category: Others]] |
Latest revision as of 13:12, 23 March 2014
// Constant TASKLIST = "Ittichai's list"; // ----------------------------------------------------- function getTasklistId_(tasklistName) { var tasklistsList = Tasks.Tasklists.list(); var taskLists = tasklistsList.getItems(); for (tl in taskLists) { var title = taskLists[tl].getTitle(); if (title == tasklistName) { return taskLists[tl].getId(); } } } function main() { // Get the task ID defined in TASKLIST var tasklistid = getTasklistId_(TASKLIST) // Get all tasks in the task list var tasks = Tasks.Tasks.list(tasklistid).getItems(); for(var i in tasks){ var tasktitle = tasks[i].getTitle(); var tasknotes = tasks[i].getNotes(); MailApp.sendEmail('ittichai@gmail.com', tasktitle, tasknotes); } }
- See this note to understand what needs to be done to run this script - http://ittichaicham.com/wiki/Create_Google_Tasks_by_sending_email_to_Google_GMail