تنظيم صفحاتك في مجموعات يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
تتيح لك خدمة "مهام Google" استخدام Google Tasks API في "برمجة تطبيقات Google". تتيح واجهة برمجة التطبيقات هذه للمستخدمين إدارة مهامهم في Gmail.
مراجع
للحصول على معلومات مفصّلة حول هذه الخدمة، يُرجى الاطّلاع على المستندات المرجعية الخاصة بواجهة Tasks API. مثل جميع الخدمات المتقدّمة في Apps Script، تستخدم خدمة Tasks الكائنات والطُرق والمعلَمات نفسها التي تستخدمها واجهة برمجة التطبيقات المتاحة للجميع. لمزيد من المعلومات، اطّلِع على كيفية تحديد تواقيع الطرق.
/** * Lists the titles and IDs of tasksList. * @see https://developers.google.com/tasks/reference/rest/v1/tasklists/list */functionlistTaskLists(){try{// Returns all the authenticated user's task lists.consttaskLists=Tasks.Tasklists.list();// If taskLists are available then print all tasklists.if(!taskLists.items){console.log('No task lists found.');return;}// Print the tasklist title and tasklist id.for(leti=0;i < taskLists.items.length;i++){consttaskList=taskLists.items[i];console.log('Task list with title "%s" and ID "%s" was found.',taskList.title,taskList.id);}}catch(err){// TODO (developer) - Handle exception from Task APIconsole.log('Failed with an error %s ',err.message);}}
/** * Lists task items for a provided tasklist ID. * @param {string} taskListId The tasklist ID. * @see https://developers.google.com/tasks/reference/rest/v1/tasks/list */functionlistTasks(taskListId){try{// List the task items of specified tasklist using taskList id.consttasks=Tasks.Tasks.list(taskListId);// If tasks are available then print all task of given tasklists.if(!tasks.items){console.log('No tasks found.');return;}// Print the task title and task id of specified tasklist.for(leti=0;i < tasks.items.length;i++){consttask=tasks.items[i];console.log('Task with title "%s" and ID "%s" was found.',task.title,task.id);}}catch(err){// TODO (developer) - Handle exception from Task APIconsole.log('Failed with an error %s',err.message);}}
/** * Adds a task to a tasklist. * @param {string} taskListId The tasklist to add to. * @see https://developers.google.com/tasks/reference/rest/v1/tasks/insert */functionaddTask(taskListId){// Task details with title and notes for inserting new tasklettask={title:'Pick up dry cleaning',notes:'Remember to get this done!'};try{// Call insert method with taskDetails and taskListId to insert Task to specified tasklist.task=Tasks.Tasks.insert(task,taskListId);// Print the Task ID of created task.console.log('Task with ID "%s" was created.',task.id);}catch(err){// TODO (developer) - Handle exception from Tasks.insert() of Task APIconsole.log('Failed with an error %s',err.message);}}
تاريخ التعديل الأخير: 2025-08-04 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","easyToUnderstand","thumb-up"],["ساعَدني المحتوى في حلّ مشكلتي.","solvedMyProblem","thumb-up"],["غير ذلك","otherUp","thumb-up"]],[["لا يحتوي على المعلومات التي أحتاج إليها.","missingTheInformationINeed","thumb-down"],["الخطوات معقدة للغاية / كثيرة جدًا.","tooComplicatedTooManySteps","thumb-down"],["المحتوى قديم.","outOfDate","thumb-down"],["ثمة مشكلة في الترجمة.","translationIssue","thumb-down"],["مشكلة في العيّنات / التعليمات البرمجية","samplesCodeIssue","thumb-down"],["غير ذلك","otherDown","thumb-down"]],["تاريخ التعديل الأخير: 2025-08-04 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\u003cp\u003eThe Tasks service in Apps Script enables you to manage tasks in Gmail using the Google Tasks API.\u003c/p\u003e\n"],["\u003cp\u003eThis advanced service requires enabling before use and utilizes the same structure as the public Tasks API.\u003c/p\u003e\n"],["\u003cp\u003eSample code is provided to demonstrate common operations like listing task lists, listing tasks within a list, and adding new tasks.\u003c/p\u003e\n"],["\u003cp\u003eA simple tasks web application showcases read and write operations with the Tasks service and is available with full source code on GitHub.\u003c/p\u003e\n"],["\u003cp\u003eSupport and further information regarding the Tasks service can be found in the Tasks support guide and reference documentation.\u003c/p\u003e\n"]]],[],null,["The Tasks service allows you to use the\n[Google Tasks API](/tasks) in Apps Script. This API\ngives users the ability to manage their tasks in Gmail.\n| **Note:** This is an advanced service that must be [enabled before use](/apps-script/guides/services/advanced).\n\nReference\n\nFor detailed information on this service, see the\n[reference documentation](/tasks/v1/reference) for the Tasks API.\nLike all advanced services in Apps Script, the Tasks service uses the same\nobjects, methods, and parameters as the public API. For more information, see [How method signatures are determined](/apps-script/guides/services/advanced#how_method_signatures_are_determined).\n\nTo report issues and find other support, see the\n[Tasks support guide](/tasks/support).\n\nSample application\n\nThe sample web application Simple Tasks demonstrates how to use the Tasks\nservice for both read and write operations. You can view the full source code\non our\n[GitHub repository](https://github.com/googleworkspace/apps-script-samples/tree/main/tasks/simpleTasks).\n\n[](https://github.com/googleworkspace/apps-script-samples/tree/main/tasks/simpleTasks)\n\nSample code\n\nThe sample code below uses [version 1](/tasks/v1/reference) of\nthe API.\n\nList task lists\n\nThis sample lists the task lists in your account. \nadvanced/tasks.gs \n[View on GitHub](https://github.com/googleworkspace/apps-script-samples/blob/main/advanced/tasks.gs) \n\n```gosu\n/**\n * Lists the titles and IDs of tasksList.\n * @see https://developers.google.com/tasks/reference/rest/v1/tasklists/list\n */\nfunction listTaskLists() {\n try {\n // Returns all the authenticated user's task lists.\n const taskLists = Tasks.Tasklists.list();\n // If taskLists are available then print all tasklists.\n if (!taskLists.items) {\n console.log('No task lists found.');\n return;\n }\n // Print the tasklist title and tasklist id.\n for (let i = 0; i \u003c taskLists.items.length; i++) {\n const taskList = taskLists.items[i];\n console.log('Task list with title \"%s\" and ID \"%s\" was found.', taskList.title, taskList.id);\n }\n } catch (err) {\n // TODO (developer) - Handle exception from Task API\n console.log('Failed with an error %s ', err.message);\n }\n}\n```\n\nList tasks\n\nThis sample lists the tasks within a given task list. \nadvanced/tasks.gs \n[View on GitHub](https://github.com/googleworkspace/apps-script-samples/blob/main/advanced/tasks.gs) \n\n```gosu\n/**\n * Lists task items for a provided tasklist ID.\n * @param {string} taskListId The tasklist ID.\n * @see https://developers.google.com/tasks/reference/rest/v1/tasks/list\n */\nfunction listTasks(taskListId) {\n try {\n // List the task items of specified tasklist using taskList id.\n const tasks = Tasks.Tasks.list(taskListId);\n // If tasks are available then print all task of given tasklists.\n if (!tasks.items) {\n console.log('No tasks found.');\n return;\n }\n // Print the task title and task id of specified tasklist.\n for (let i = 0; i \u003c tasks.items.length; i++) {\n const task = tasks.items[i];\n console.log('Task with title \"%s\" and ID \"%s\" was found.', task.title, task.id);\n }\n } catch (err) {\n // TODO (developer) - Handle exception from Task API\n console.log('Failed with an error %s', err.message);\n }\n}\n```\n\nAdd task\n\nThis sample adds a new task to a task list. \nadvanced/tasks.gs \n[View on GitHub](https://github.com/googleworkspace/apps-script-samples/blob/main/advanced/tasks.gs) \n\n```gosu\n/**\n * Adds a task to a tasklist.\n * @param {string} taskListId The tasklist to add to.\n * @see https://developers.google.com/tasks/reference/rest/v1/tasks/insert\n */\nfunction addTask(taskListId) {\n // Task details with title and notes for inserting new task\n let task = {\n title: 'Pick up dry cleaning',\n notes: 'Remember to get this done!'\n };\n try {\n // Call insert method with taskDetails and taskListId to insert Task to specified tasklist.\n task = Tasks.Tasks.insert(task, taskListId);\n // Print the Task ID of created task.\n console.log('Task with ID \"%s\" was created.', task.id);\n } catch (err) {\n // TODO (developer) - Handle exception from Tasks.insert() of Task API\n console.log('Failed with an error %s', err.message);\n }\n}\n```"]]