Skip to content

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

feat(microsoft-todo): add AI actions and output schemas (#16099)

Kishan Parmarbd4fb803f8c3
diff --git a/packages/pieces/community/microsoft-todo/package.json b/packages/pieces/community/microsoft-todo/package.json
index 5228d478d6c..a99b8bd7106 100644
--- a/packages/pieces/community/microsoft-todo/package.json
+++ b/packages/pieces/community/microsoft-todo/package.json
@@ -1,6 +1,6 @@
{
"name": "@activepieces/piece-microsoft-todo",
- "version": "0.4.0",
+ "version": "0.5.0",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
"dependencies": {
diff --git a/packages/pieces/community/microsoft-todo/src/index.ts b/packages/pieces/community/microsoft-todo/src/index.ts
index aa487ca3cf0..30a8dfa7421 100644
--- a/packages/pieces/community/microsoft-todo/src/index.ts
+++ b/packages/pieces/community/microsoft-todo/src/index.ts
@@ -19,6 +19,36 @@ import { updateTaskListAction } from './lib/actions/update-task-list';
import { listTasksAction } from './lib/actions/list-tasks';
import { listTaskListsAction } from './lib/actions/list-task-lists';
+import { microsoftTodoCompleteTaskAction } from './lib/actions/ai/complete-task';
+import { microsoftTodoCreateChecklistItemAction } from './lib/actions/ai/create-checklist-item';
+import { microsoftTodoCreateLinkedResourceAction } from './lib/actions/ai/create-linked-resource';
+import { microsoftTodoCreateTaskAction } from './lib/actions/ai/create-task';
+import { microsoftTodoCreateTaskListAction } from './lib/actions/ai/create-task-list';
+import { microsoftTodoDeleteChecklistItemAction } from './lib/actions/ai/delete-checklist-item';
+import { microsoftTodoDeleteLinkedResourceAction } from './lib/actions/ai/delete-linked-resource';
+import { microsoftTodoDeleteTaskAction } from './lib/actions/ai/delete-task';
+import { microsoftTodoDeleteTaskAttachmentAction } from './lib/actions/ai/delete-task-attachment';
+import { microsoftTodoDeleteTaskListAction } from './lib/actions/ai/delete-task-list';
+import { microsoftTodoDownloadTaskAttachmentAction } from './lib/actions/ai/download-task-attachment';
+import { microsoftTodoGetChecklistItemAction } from './lib/actions/ai/get-checklist-item';
+import { microsoftTodoGetCurrentUserAction } from './lib/actions/ai/get-current-user';
+import { microsoftTodoGetLinkedResourceAction } from './lib/actions/ai/get-linked-resource';
+import { microsoftTodoGetTaskAction } from './lib/actions/ai/get-task';
+import { microsoftTodoGetTaskAttachmentAction } from './lib/actions/ai/get-task-attachment';
+import { microsoftTodoGetTaskListAction } from './lib/actions/ai/get-task-list';
+import { microsoftTodoListChecklistItemsAction } from './lib/actions/ai/list-checklist-items';
+import { microsoftTodoListLinkedResourcesAction } from './lib/actions/ai/list-linked-resources';
+import { microsoftTodoListTaskAttachmentsAction } from './lib/actions/ai/list-task-attachments';
+import { microsoftTodoListTaskListsAction } from './lib/actions/ai/list-task-lists';
+import { microsoftTodoMoveTaskAction } from './lib/actions/ai/move-task';
+import { microsoftTodoSearchTasksAction } from './lib/actions/ai/search-tasks';
+import { microsoftTodoListTasksAction } from './lib/actions/ai/list-tasks';
+import { microsoftTodoUpdateChecklistItemAction } from './lib/actions/ai/update-checklist-item';
+import { microsoftTodoUpdateLinkedResourceAction } from './lib/actions/ai/update-linked-resource';
+import { microsoftTodoUpdateTaskAction } from './lib/actions/ai/update-task';
+import { microsoftTodoUpdateTaskListAction } from './lib/actions/ai/update-task-list';
+import { microsoftTodoUploadTaskAttachmentAction } from './lib/actions/ai/upload-task-attachment';
+
import { microsoftToDoAuth } from './lib/auth';
import { newListCreatedTrigger } from './lib/triggers/new-list-created';
import { newTaskCreatedTrigger } from './lib/triggers/new-task-created';
@@ -30,7 +60,7 @@ export const microsoftTodo = createPiece({
description: 'Cloud based task management application.',
categories: [PieceCategory.PRODUCTIVITY],
auth: microsoftToDoAuth,
- minimumSupportedRelease: '0.36.1',
+ minimumSupportedRelease: '0.88.2',
logoUrl: 'https://cdn.activepieces.com/pieces/microsoft-todo.png',
authors: ['onyedikachi-david', 'david-oluwaseun420'],
actions: [
@@ -46,6 +76,35 @@ export const microsoftTodo = createPiece({
getTaskAction,
findTaskListByNameAction,
findTaskByTitleAction,
+ microsoftTodoCompleteTaskAction,
+ microsoftTodoCreateChecklistItemAction,
+ microsoftTodoCreateLinkedResourceAction,
+ microsoftTodoCreateTaskAction,
+ microsoftTodoCreateTaskListAction,
+ microsoftTodoDeleteChecklistItemAction,
+ microsoftTodoDeleteLinkedResourceAction,
+ microsoftTodoDeleteTaskAction,
+ microsoftTodoDeleteTaskAttachmentAction,
+ microsoftTodoDeleteTaskListAction,
+ microsoftTodoDownloadTaskAttachmentAction,
+ microsoftTodoGetChecklistItemAction,
+ microsoftTodoGetCurrentUserAction,
+ microsoftTodoGetLinkedResourceAction,
+ microsoftTodoGetTaskAction,
+ microsoftTodoGetTaskAttachmentAction,
+ microsoftTodoGetTaskListAction,
+ microsoftTodoListChecklistItemsAction,
+ microsoftTodoListLinkedResourcesAction,
+ microsoftTodoListTaskAttachmentsAction,
+ microsoftTodoListTaskListsAction,
+ microsoftTodoListTasksAction,
+ microsoftTodoSearchTasksAction,
+ microsoftTodoMoveTaskAction,
+ microsoftTodoUpdateChecklistItemAction,
+ microsoftTodoUpdateLinkedResourceAction,
+ microsoftTodoUpdateTaskAction,
+ microsoftTodoUpdateTaskListAction,
+ microsoftTodoUploadTaskAttachmentAction,
createCustomApiCallAction({
baseUrl: (auth) => {
const cloud = (auth as OAuth2PropertyValue).props?.['cloud'] as string | undefined;
diff --git a/packages/pieces/community/microsoft-todo/src/lib/actions/add-attachment.ts b/packages/pieces/community/microsoft-todo/src/lib/actions/add-attachment.ts
index dde42ee376d..9d22fed5327 100644
--- a/packages/pieces/community/microsoft-todo/src/lib/actions/add-attachment.ts
+++ b/packages/pieces/community/microsoft-todo/src/lib/actions/add-attachment.ts
@@ -2,14 +2,16 @@ import { Property, createAction, OAuth2PropertyValue } from '@activepieces/piece
import { getTaskListsDropdown, getTasksInListDropdown, createTodoClient } from '../common';
import { TaskFileAttachment } from '@microsoft/microsoft-graph-types';
import { microsoftToDoAuth } from '../auth';
+import { addAttachmentOutputSchema } from '../output-schemas';
export const addAttachmentAction = createAction({
auth: microsoftToDoAuth,
name: 'add_attachment',
+ outputSchema: addAttachmentOutputSchema,
classification: 'WRITE',
displayName: 'Add an Attachment',
description: 'Adds an attachment to a task.',
- audience: 'both',
+ audience: 'human',
aiMetadata: { description: 'Upload a file as an attachment onto a specific Microsoft To Do task, identified by task list id and task id. Handles both small files (inline upload) and larger ones (chunked upload session) automatically; files must be 25 MB or smaller. Use to attach a document to a task. Not idempotent — each call adds another attachment even if the same file was already attached.', idempotent: false },
props: {
task_list_id: Property.Dropdown({
diff --git a/packages/pieces/community/microsoft-todo/src/lib/actions/ai/complete-task.ts b/packages/pieces/community/microsoft-todo/src/lib/actions/ai/complete-task.ts
new file mode 100644
index 00000000000..0a9cd37eddb
--- /dev/null
+++ b/packages/pieces/community/microsoft-todo/src/lib/actions/ai/complete-task.ts
@@ -0,0 +1,34 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { TodoTask } from '@microsoft/microsoft-graph-types';
+import { microsoftToDoAuth } from '../../auth';
+import { createTodoClient } from '../../common';
+import { todoApi } from '../../common/todo-api';
+import { todoProps } from '../../common/todo-props';
+import { taskOutputSchema } from '../../output-schemas';
+
+export const microsoftTodoCompleteTaskAction = createAction({
+ auth: microsoftToDoAuth,
+ name: 'microsoft_todo_complete_task',
+ outputSchema: taskOutputSchema,
+ displayName: 'Complete Task',
+ description: 'Mark a task as completed.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Mark a Microsoft To Do task as completed, identified by list ID and task ID (from List Tasks); To Do records the completion time. To reopen a task, use Update Task with status Not Started. Completing an already completed task keeps it completed.',
+ idempotent: true,
+ },
+ props: {
+ list_id: todoProps.listId(),
+ task_id: todoProps.taskId(),
+ },
+ async run(context) {
+ const { list_id, task_id } = context.propsValue;
+ const client = createTodoClient(context.auth);
+ const task: TodoTask = await client
+ .api(todoApi.taskPath({ listId: list_id, taskId: task_id }))
+ .update({ status: 'completed' });
+ return todoApi.toTask(task);
+ },
+});
diff --git a/packages/pieces/community/microsoft-todo/src/lib/actions/ai/create-checklist-item.ts b/packages/pieces/community/microsoft-todo/src/lib/actions/ai/create-checklist-item.ts
new file mode 100644
index 00000000000..0740428f177
--- /dev/null
+++ b/packages/pieces/community/microsoft-todo/src/lib/actions/ai/create-checklist-item.ts
@@ -0,0 +1,45 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { ChecklistItem } from '@microsoft/microsoft-graph-types';
+import { microsoftToDoAuth } from '../../auth';
+import { createTodoClient } from '../../common';
+import { todoApi } from '../../common/todo-api';
+import { todoProps } from '../../common/todo-props';
+import { checklistItemOutputSchema } from '../../output-schemas';
+
+export const microsoftTodoCreateChecklistItemAction = createAction({
+ auth: microsoftToDoAuth,
+ name: 'microsoft_todo_create_checklist_item',
+ outputSchema: checklistItemOutputSchema,
+ displayName: 'Add Checklist Item',
+ description: 'Add a checklist item (step) to a task.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Add a checklist item (a "step" or subtask) to a Microsoft To Do task, identified by list ID and task ID from List Tasks, optionally already checked. Not idempotent: every call adds another item, even with the same text.',
+ idempotent: false,
+ },
+ props: {
+ list_id: todoProps.listId(),
+ task_id: todoProps.taskId(),
+ display_name: Property.ShortText({
+ displayName: 'Text',
+ description: 'Text of the checklist item.',
+ required: true,
+ }),
+ is_checked: Property.Checkbox({
+ displayName: 'Checked',
+ description: 'Create the item already checked off.',
+ required: false,
+ defaultValue: false,
+ }),
+ },
+ async run(context) {
+ const { list_id, task_id, display_name, is_checked } = context.propsValue;
+ const client = createTodoClient(context.auth);
+ const item: ChecklistItem = await client
+ .api(`${todoApi.taskPath({ listId: list_id, taskId: task_id })}/checklistItems`)
+ .post({ displayName: display_name, isChecked: is_checked ?? false });
+ return todoApi.toChecklistItem(item);
+ },
+});
diff --git a/packages/pieces/community/microsoft-todo/src/lib/actions/ai/create-linked-resource.ts b/packages/pieces/community/microsoft-todo/src/lib/actions/ai/create-linked-resource.ts
new file mode 100644
index 00000000000..ea82eec8aa6
--- /dev/null
+++ b/packages/pieces/community/microsoft-todo/src/lib/actions/ai/create-linked-resource.ts
@@ -0,0 +1,59 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { LinkedResource } from '@microsoft/microsoft-graph-types';
+import { microsoftToDoAuth } from '../../auth';
+import { createTodoClient } from '../../common';
+import { todoApi } from '../../common/todo-api';
+import { todoProps } from '../../common/todo-props';
+import { linkedResourceOutputSchema } from '../../output-schemas';
+
+export const microsoftTodoCreateLinkedResourceAction = createAction({
+ auth: microsoftToDoAuth,
+ name: 'microsoft_todo_create_linked_resource',
+ outputSchema: linkedResourceOutputSchema,
+ displayName: 'Create Linked Resource',
+ description: 'Link a task back to the item it came from.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Attach a linked resource to a Microsoft To Do task: a link back to the item that created it (an email, ticket, CRM record or web page), shown in the task details. Identify the task by list ID and task ID from List Tasks. Not idempotent: every call adds another link.',
+ idempotent: false,
+ },
+ props: {
+ list_id: todoProps.listId(),
+ task_id: todoProps.taskId(),
+ display_name: Property.ShortText({
+ displayName: 'Title',
+ description: 'Title of the linked item, for example the email subject.',
+ required: true,
+ }),
+ application_name: Property.ShortText({
+ displayName: 'Application Name',
+ description: 'Name of the app the item comes from, for example "Zendesk".',
+ required: true,
+ }),
+ web_url: Property.ShortText({
+ displayName: 'URL',
+ description: 'Link that opens the item.',
+ required: false,
+ }),
+ external_id: Property.ShortText({
+ displayName: 'External ID',
+ description: 'ID of the item in the source app.',
+ required: false,
+ }),
+ },
+ async run(context) {
+ const { list_id, task_id, display_name, application_name, web_url, external_id } = context.propsValue;
+ const client = createTodoClient(context.auth);
+ const resource: LinkedResource = await client
+ .api(`${todoApi.taskPath({ listId: list_id, taskId: task_id })}/linkedResources`)
+ .post({
+ displayName: display_name,
+ applicationName: application_name,
+ ...(web_url ? { webUrl: web_url } : {}),
+ ...(external_id ? { externalId: external_id } : {}),
+ });
+ return todoApi.toLinkedResource(resource);
+ },
+});
diff --git a/packages/pieces/community/microsoft-todo/src/lib/actions/ai/create-task-list.ts b/packages/pieces/community/microsoft-todo/src/lib/actions/ai/create-task-list.ts
new file mode 100644
index 00000000000..bb71da806d3
--- /dev/null
+++ b/packages/pieces/community/microsoft-todo/src/lib/actions/ai/create-task-list.ts
@@ -0,0 +1,35 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { TodoTaskList } from '@microsoft/microsoft-graph-types';
+import { microsoftToDoAuth } from '../../auth';
+import { createTodoClient } from '../../common';
+import { todoApi } from '../../common/todo-api';
+import { taskListOutputSchema } from '../../output-schemas';
+
+export const microsoftTodoCreateTaskListAction = createAction({
+ auth: microsoftToDoAuth,
+ name: 'microsoft_todo_create_task_list',
+ outputSchema: taskListOutputSchema,
+ displayName: 'Create Task List',
+ description: 'Create a new task list.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Create a new Microsoft To Do task list and return its ID. To Do allows several lists with the same name, so check List Task Lists first if a duplicate would be a problem. Not idempotent: every call creates another list.',
+ idempotent: false,
+ },
+ props: {
+ display_name: Property.ShortText({
+ displayName: 'Name',
+ description: 'Name of the new task list.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const client = createTodoClient(context.auth);
+ const list: TodoTaskList = await client
+ .api('/me/todo/lists')
+ .post({ displayName: context.propsValue.display_name });
+ return todoApi.toTaskList(list);
+ },
+});
diff --git a/packages/pieces/community/microsoft-todo/src/lib/actions/ai/create-task.ts b/packages/pieces/community/microsoft-todo/src/lib/actions/ai/create-task.ts
new file mode 100644
index 00000000000..b05d998c582
--- /dev/null
+++ b/packages/pieces/community/microsoft-todo/src/lib/actions/ai/create-task.ts
@@ -0,0 +1,86 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { TodoTask } from '@microsoft/microsoft-graph-types';
+import { microsoftToDoAuth } from '../../auth';
+import { createTodoClient } from '../../common';
+import { IMPORTANCE_OPTIONS, TASK_STATUS_OPTIONS, todoApi } from '../../common/todo-api';
+import { todoProps } from '../../common/todo-props';
+import { taskOutputSchema } from '../../output-schemas';
+
+export const microsoftTodoCreateTaskAction = createAction({
+ auth: microsoftToDoAuth,
+ name: 'microsoft_todo_create_task',
+ outputSchema: taskOutputSchema,
+ displayName: 'Create Task',
+ description: 'Create a task in a task list.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Create a task in a Microsoft To Do task list (ID from List Task Lists) with a title and optional notes, importance, status, due, start and reminder times (UTC) and categories. Setting a reminder turns the reminder on. Not idempotent: every call adds another task, even with the same title.',
+ idempotent: false,
+ },
+ props: {
+ list_id: todoProps.listId(),
+ title: Property.ShortText({
+ displayName: 'Title',
+ description: 'Title of the task.',
+ required: true,
+ }),
+ body: Property.LongText({
+ displayName: 'Notes',
+ description: 'Plain-text notes for the task.',
+ required: false,
+ }),
+ importance: Property.StaticDropdown({
+ displayName: 'Importance',
+ description: 'Defaults to Normal.',
+ required: false,
+ options: { options: IMPORTANCE_OPTIONS },
+ }),
+ status: Property.StaticDropdown({
+ displayName: 'Status',
+ description: 'Defaults to Not Started.',
+ required: false,
+ options: { options: TASK_STATUS_OPTIONS },
+ }),
+ due_date_time: Property.DateTime({
+ displayName: 'Due Date',
+ description: 'When the task is due, in UTC.',
+ required: false,
+ }),
+ start_date_time: Property.DateTime({
+ displayName: 'Start Date',
+ description: 'When the task is scheduled to start, in UTC.',
+ required: false,
+ }),
+ reminder_date_time: Property.DateTime({
+ displayName: 'Reminder',
+ description: 'When to remind the user, in UTC.',
+ required: false,
+ }),
+ categories: Property.Array({
+ displayName: 'Categories',
+ description: 'Category names, matching the user\'s Outlook categories.',
+ required: false,
+ }),
+ },
+ async run(context) {
+ const { list_id, title, body, importance, status, due_date_time, start_date_time, reminder_date_time, categories } =
+ context.propsValue;
+ const reminder = todoApi.toDateTimeTimeZone(reminder_date_time);
+ const task: TodoTask = {
+ title,
+ ...(body ? { body: { content: body, contentType: 'text' } } : {}),
+ ...(importance ? { importance: todoApi.toImportance(importance) } : {}),
+ ...(status ? { status: todoApi.toStatus(status) } : {}),
+ ...(due_date_time ? { dueDateTime: todoApi.toDateTimeTimeZone(due_date_time) } : {}),
+ ...(start_date_time ? { startDateTime: todoApi.toDateTimeTimeZone(start_date_time) } : {}),
+ ...(reminder ? { reminderDateTime: reminder, isReminderOn: true } : {}),
+ ...(categories ? { categories: categories.filter((c): c is string => typeof c === 'string') } : {}),
+ };
+ const client = createTodoClient(context.auth);
+ const created: TodoTask = await client.api(`${todoApi.listPath({ listId: list_id })}/tasks`).post(task);
+ return todoApi.toTask(created);
+ },
+});
+
diff --git a/packages/pieces/community/microsoft-todo/src/lib/actions/ai/delete-checklist-item.ts b/packages/pieces/community/microsoft-todo/src/lib/actions/ai/delete-checklist-item.ts
new file mode 100644
index 00000000000..69a97c68e42
--- /dev/null
+++ b/packages/pieces/community/microsoft-todo/src/lib/actions/ai/delete-checklist-item.ts
@@ -0,0 +1,34 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { microsoftToDoAuth } from '../../auth';
+import { createTodoClient } from '../../common';
+import { todoApi } from '../../common/todo-api';
+import { todoProps } from '../../common/todo-props';
+import { microsoftTodoDeleteChecklistItemOutputSchema } from '../../output-schemas';
+
+export const microsoftTodoDeleteChecklistItemAction = createAction({
+ auth: microsoftToDoAuth,
+ name: 'microsoft_todo_delete_checklist_item',
+ outputSchema: microsoftTodoDeleteChecklistItemOutputSchema,
+ displayName: 'Delete Checklist Item',
+ description: 'Permanently delete a checklist item from a task.',
+ audience: 'ai',
+ classification: 'DESTRUCTIVE',
+ aiMetadata: {
+ description:
+ 'Permanently remove one checklist item (step) from a Microsoft To Do task; this cannot be undone. Get the ID from List Checklist Items; to just tick it off, use Update Checklist Item instead. A retry after success fails with not found.',
+ idempotent: false,
+ },
+ props: {
+ list_id: todoProps.listId(),
+ task_id: todoProps.taskId(),
+ checklist_item_id: todoProps.checklistItemId(),
+ },
+ async run(context) {
+ const listId = context.propsValue.list_id.trim();
+ const taskId = context.propsValue.task_id.trim();
+ const checklistItemId = context.propsValue.checklist_item_id.trim();
+ const client = createTodoClient(context.auth);
+ await client.api(todoApi.checklistItemPath({ listId, taskId, checklistItemId })).delete();
+ return { success: true, listId, taskId, checklistItemId };
+ },
+});
diff --git a/packages/pieces/community/microsoft-todo/src/lib/actions/ai/delete-linked-resource.ts b/packages/pieces/community/microsoft-todo/src/lib/actions/ai/delete-linked-resource.ts
new file mode 100644
index 00000000000..b288f70568e
--- /dev/null
+++ b/packages/pieces/community/microsoft-todo/src/lib/actions/ai/delete-linked-resource.ts
@@ -0,0 +1,34 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { microsoftToDoAuth } from '../../auth';
+import { createTodoClient } from '../../common';
+import { todoApi } from '../../common/todo-api';
+import { todoProps } from '../../common/todo-props';
+import { microsoftTodoDeleteLinkedResourceOutputSchema } from '../../output-schemas';
+
+export const microsoftTodoDeleteLinkedResourceAction = createAction({
+ auth: microsoftToDoAuth,
+ name: 'microsoft_todo_delete_linked_resource',
+ outputSchema: microsoftTodoDeleteLinkedResourceOutputSchema,
+ displayName: 'Delete Linked Resource',
+ description: 'Remove a linked resource from a task.',
+ audience: 'ai',
+ classification: 'DESTRUCTIVE',
+ aiMetadata: {
+ description:
+ 'Permanently remove one linked resource from a Microsoft To Do task; the source item itself is not touched. Get the ID from List Linked Resources. A retry after success fails with not found.',
+ idempotent: false,
+ },
+ props: {
+ list_id: todoProps.listId(),
+ task_id: todoProps.taskId(),
+ linked_resource_id: todoProps.linkedResourceId(),
+ },
+ async run(context) {
+ const listId = context.propsValue.list_id.trim();
+ const taskId = context.propsValue.task_id.trim();
+ const linkedResourceId = context.propsValue.linked_resource_id.trim();
+ const client = createTodoClient(context.auth);
+ await client.api(todoApi.linkedResourcePath({ listId, taskId, linkedResourceId })).delete();
+ return { success: true, listId, taskId, linkedResourceId };
+ },
+});
diff --git a/packages/pieces/community/microsoft-todo/src/lib/actions/ai/delete-task-attachment.ts b/packages/pieces/community/microsoft-todo/src/lib/actions/ai/delete-task-attachment.ts
new file mode 100644
index 00000000000..ee991a929e8
--- /dev/null
+++ b/packages/pieces/community/microsoft-todo/src/lib/actions/ai/delete-task-attachment.ts
@@ -0,0 +1,34 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { microsoftToDoAuth } from '../../auth';
+import { createTodoClient } from '../../common';
+import { todoApi } from '../../common/todo-api';
+import { todoProps } from '../../common/todo-props';
+import { microsoftTodoDeleteTaskAttachmentOutputSchema } from '../../output-schemas';
+
+export const microsoftTodoDeleteTaskAttachmentAction = createAction({
+ auth: microsoftToDoAuth,
+ name: 'microsoft_todo_delete_task_attachment',
+ outputSchema: microsoftTodoDeleteTaskAttachmentOutputSchema,
+ displayName: 'Delete Task Attachment',
+ description: 'Permanently remove a file attached to a task.',
+ audience: 'ai',
+ classification: 'DESTRUCTIVE',
+ aiMetadata: {
+ description:
+ 'Permanently delete one file attached to a Microsoft To Do task; this cannot be undone. Get the attachment ID from List Task Attachments. A retry after success fails with not found.',
+ idempotent: false,
+ },
+ props: {
+ list_id: todoProps.listId(),
+ task_id: todoProps.taskId(),
+ attachment_id: todoProps.attachmentId(),
+ },
+ async run(context) {
+ const listId = context.propsValue.list_id.trim();
+ const taskId = context.propsValue.task_id.trim();
+ const attachmentId = context.propsValue.attachment_id.trim();
+ const client = createTodoClient(context.auth);
+ await client.api(todoApi.attachmentPath({ listId, taskId, attachmentId })).delete();
+ return { success: true, listId, taskId, attachmentId };
+ },
+});
diff --git a/packages/pieces/community/microsoft-todo/src/lib/actions/ai/delete-task-list.ts b/packages/pieces/community/microsoft-todo/src/lib/actions/ai/delete-task-list.ts
new file mode 100644
index 00000000000..4aaaa34a349
--- /dev/null
+++ b/packages/pieces/community/microsoft-todo/src/lib/actions/ai/delete-task-list.ts
@@ -0,0 +1,30 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { microsoftToDoAuth } from '../../auth';
+import { createTodoClient } from '../../common';
+import { todoApi } from '../../common/todo-api';
+import { todoProps } from '../../common/todo-props';
+import { microsoftTodoDeleteTaskListOutputSchema } from '../../output-schemas';
+
+export const microsoftTodoDeleteTaskListAction = createAction({
+ auth: microsoftToDoAuth,
+ name: 'microsoft_todo_delete_task_list',
+ outputSchema: microsoftTodoDeleteTaskListOutputSchema,
+ displayName: 'Delete Task List',
+ description: 'Permanently delete a task list and all of its tasks.',
+ audience: 'ai',
+ classification: 'DESTRUCTIVE',
+ aiMetadata: {
+ description:
+ 'Permanently delete a Microsoft To Do task list together with every task in it; this cannot be undone. Get the ID from List Task Lists. The built-in "Tasks" and "Flagged email" lists cannot be deleted, and a retry after success fails with not found.',
+ idempotent: false,
+ },
+ props: {
+ list_id: todoProps.listId(),
+ },
+ async run(context) {
+ const listId = context.propsValue.list_id.trim();
+ const client = createTodoClient(context.auth);
+ await client.api(todoApi.listPath({ listId })).delete();
+ return { success: true, listId };
+ },
+});
diff --git a/packages/pieces/community/microsoft-todo/src/lib/actions/ai/delete-task.ts b/packages/pieces/community/microsoft-todo/src/lib/actions/ai/delete-task.ts
new file mode 100644
index 00000000000..91b168b97c5
--- /dev/null
+++ b/packages/pieces/community/microsoft-todo/src/lib/actions/ai/delete-task.ts
@@ -0,0 +1,32 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { microsoftToDoAuth } from '../../auth';
+import { createTodoClient } from '../../common';
+import { todoApi } from '../../common/todo-api';
+import { todoProps } from '../../common/todo-props';
+import { microsoftTodoDeleteTaskOutputSchema } from '../../output-schemas';
+
+export const microsoftTodoDeleteTaskAction = createAction({
+ auth: microsoftToDoAuth,
+ name: 'microsoft_todo_delete_task',
+ outputSchema: microsoftTodoDeleteTaskOutputSchema,
+ displayName: 'Delete Task',
+ description: 'Permanently delete a task.',
+ audience: 'ai',
+ classification: 'DESTRUCTIVE',
+ aiMetadata: {
+ description:
+ 'Permanently delete a Microsoft To Do task with its checklist items, links and attachments; this cannot be undone. Identify it by list ID and task ID from List Tasks. Prefer Complete Task when the work is done. A retry after success fails with not found.',
+ idempotent: false,
+ },
+ props: {
+ list_id: todoProps.listId(),
+ task_id: todoProps.taskId(),
+ },
+ async run(context) {
+ const listId = context.propsValue.list_id.trim();
+ const taskId = context.propsValue.task_id.trim();
+ const client = createTodoClient(context.auth);
+ await client.api(todoApi.taskPath({ listId, taskId })).delete();
+ return { success: true, listId, taskId };
+ },
+});
diff --git a/packages/pieces/community/microsoft-todo/src/lib/actions/ai/download-task-attachment.ts b/packages/pieces/community/microsoft-todo/src/lib/actions/ai/download-task-attachment.ts
new file mode 100644
index 00000000000..81341be0790
--- /dev/null
+++ b/packages/pieces/community/microsoft-todo/src/lib/actions/ai/download-task-attachment.ts
@@ -0,0 +1,40 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { ResponseType } from '@microsoft/microsoft-graph-client';
+import { TaskFileAttachment } from '@microsoft/microsoft-graph-types';
+import { microsoftToDoAuth } from '../../auth';
+import { createTodoClient } from '../../common';
+import { todoApi } from '../../common/todo-api';
+import { todoProps } from '../../common/todo-props';
+import { microsoftTodoDownloadTaskAttachmentOutputSchema } from '../../output-schemas';
+
+export const microsoftTodoDownloadTaskAttachmentAction = createAction({
+ auth: microsoftToDoAuth,
+ name: 'microsoft_todo_download_task_attachment',
+ outputSchema: microsoftTodoDownloadTaskAttachmentOutputSchema,
+ displayName: 'Download Task Attachment',
+ description: 'Download a file attached to a task.',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description:
+ 'Download the content of one file attached to a Microsoft To Do task and return it as a file reference other steps can use. Get the attachment ID from List Task Attachments. Read-only.',
+ idempotent: true,
+ },
+ props: {
+ list_id: todoProps.listId(),
+ task_id: todoProps.taskId(),
+ attachment_id: todoProps.attachmentId(),
+ },
+ async run(context) {
+ const { list_id, task_id, attachment_id } = context.propsValue;
+ const client = createTodoClient(context.auth);
+ const path = todoApi.attachmentPath({ listId: list_id, taskId: task_id, attachmentId: attachment_id });
+ const attachment: TaskFileAttachment = await client.api(path).get();
+ const content: ArrayBuffer = await client.api(`${path}/$value`).responseType(ResponseType.ARRAYBUFFER).get();
+ const fileName = attachment.name ?? 'attachment';
+ return {
+ ...todoApi.toAttachment(attachment),
+ file: await context.files.write({ fileName, data: Buffer.from(content) }),
+ };
+ },
+});
diff --git a/packages/pieces/community/microsoft-todo/src/lib/actions/ai/get-checklist-item.ts b/packages/pieces/community/microsoft-todo/src/lib/actions/ai/get-checklist-item.ts
new file mode 100644
index 00000000000..f5c1b1f13ee
--- /dev/null
+++ b/packages/pieces/community/microsoft-todo/src/lib/actions/ai/get-checklist-item.ts
@@ -0,0 +1,35 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { ChecklistItem } from '@microsoft/microsoft-graph-types';
+import { microsoftToDoAuth } from '../../auth';
+import { createTodoClient } from '../../common';
+import { todoApi } from '../../common/todo-api';
+import { todoProps } from '../../common/todo-props';
+import { checklistItemOutputSchema } from '../../output-schemas';
+
+export const microsoftTodoGetChecklistItemAction = createAction({
+ auth: microsoftToDoAuth,
+ name: 'microsoft_todo_get_checklist_item',
+ outputSchema: checklistItemOutputSchema,
+ displayName: 'Get Checklist Item',
+ description: 'Get one checklist item of a task.',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description:
+ 'Read one checklist item (step) of a Microsoft To Do task: its text, checked state and dates. Get the checklist item ID from List Checklist Items. Read-only.',
+ idempotent: true,
+ },
+ props: {
+ list_id: todoProps.listId(),
+ task_id: todoProps.taskId(),
+ checklist_item_id: todoProps.checklistItemId(),
+ },
+ async run(context) {
+ const { list_id, task_id, checklist_item_id } = context.propsValue;
+ const client = createTodoClient(context.auth);
+ const item: ChecklistItem = await client
+ .api(todoApi.checklistItemPath({ listId: list_id, taskId: task_id, checklistItemId: checklist_item_id }))
+ .get();
+ return todoApi.toChecklistItem(item);
+ },
+});
diff --git a/packages/pieces/community/microsoft-todo/src/lib/actions/ai/get-current-user.ts b/packages/pieces/community/microsoft-todo/src/lib/actions/ai/get-current-user.ts
new file mode 100644
index 00000000000..aaf8c3a8503
--- /dev/null
+++ b/packages/pieces/community/microsoft-todo/src/lib/actions/ai/get-current-user.ts
@@ -0,0 +1,38 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { User } from '@microsoft/microsoft-graph-types';
+import { microsoftToDoAuth } from '../../auth';
+import { createTodoClient } from '../../common';
+import { microsoftTodoGetCurrentUserOutputSchema } from '../../output-schemas';
+
+export const microsoftTodoGetCurrentUserAction = createAction({
+ auth: microsoftToDoAuth,
+ name: 'microsoft_todo_get_current_user',
+ outputSchema: microsoftTodoGetCurrentUserOutputSchema,
+ displayName: 'Get Current User',
+ description: 'Get the profile of the connected Microsoft account.',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description:
+ 'Return the profile (ID, name, email, user principal name) of the Microsoft account this connection uses, so you can confirm whose tasks you are working with. Takes no input. Read-only.',
+ idempotent: true,
+ },
+ props: {},
+ async run(context) {
+ const client = createTodoClient(context.auth);
+ const user: User = await client
+ .api('/me')
+ .select('id,displayName,givenName,surname,mail,userPrincipalName,jobTitle,preferredLanguage')
+ .get();
+ return {
+ id: user.id ?? null,
+ displayName: user.displayName ?? null,
+ givenName: user.givenName ?? null,
+ surname: user.surname ?? null,
+ mail: user.mail ?? null,
+ userPrincipalName: user.userPrincipalName ?? null,
+ jobTitle: user.jobTitle ?? null,
+ preferredLanguage: user.preferredLanguage ?? null,
+ };
+ },
+});
diff --git a/packages/pieces/community/microsoft-todo/src/lib/actions/ai/get-linked-resource.ts b/packages/pieces/community/microsoft-todo/src/lib/actions/ai/get-linked-resource.ts
new file mode 100644
index 00000000000..044946e236e
--- /dev/null
+++ b/packages/pieces/community/microsoft-todo/src/lib/actions/ai/get-linked-resource.ts
@@ -0,0 +1,35 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { LinkedResource } from '@microsoft/microsoft-graph-types';
+import { microsoftToDoAuth } from '../../auth';
+import { createTodoClient } from '../../common';
+import { todoApi } from '../../common/todo-api';
+import { todoProps } from '../../common/todo-props';
+import { linkedResourceOutputSchema } from '../../output-schemas';
+
+export const microsoftTodoGetLinkedResourceAction = createAction({
+ auth: microsoftToDoAuth,
+ name: 'microsoft_todo_get_linked_resource',
+ outputSchema: linkedResourceOutputSchema,
+ displayName: 'Get Linked Resource',
+ description: 'Get one linked resource of a task.',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description:
+ 'Read one linked resource of a Microsoft To Do task (app name, title, URL, external ID). Get the linked resource ID from List Linked Resources. Read-only.',
+ idempotent: true,
+ },
+ props: {
+ list_id: todoProps.listId(),
+ task_id: todoProps.taskId(),
+ linked_resource_id: todoProps.linkedResourceId(),
+ },
+ async run(context) {
+ const { list_id, task_id, linked_resource_id } = context.propsValue;
+ const client = createTodoClient(context.auth);
+ const resource: LinkedResource = await client
+ .api(todoApi.linkedResourcePath({ listId: list_id, taskId: task_id, linkedResourceId: linked_resource_id }))
+ .get();
+ return todoApi.toLinkedResource(resource);
+ },
+});
diff --git a/packages/pieces/community/microsoft-todo/src/lib/actions/ai/get-task-attachment.ts b/packages/pieces/community/microsoft-todo/src/lib/actions/ai/get-task-attachment.ts
new file mode 100644
index 00000000000..983712cb5cb
--- /dev/null
+++ b/packages/pieces/community/microsoft-todo/src/lib/actions/ai/get-task-attachment.ts
@@ -0,0 +1,35 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { TaskFileAttachment } from '@microsoft/microsoft-graph-types';
+import { microsoftToDoAuth } from '../../auth';
+import { createTodoClient } from '../../common';
+import { todoApi } from '../../common/todo-api';
+import { todoProps } from '../../common/todo-props';
+import { attachmentOutputSchema } from '../../output-schemas';
+
+export const microsoftTodoGetTaskAttachmentAction = createAction({
+ auth: microsoftToDoAuth,
+ name: 'microsoft_todo_get_task_attachment',
+ outputSchema: attachmentOutputSchema,
+ displayName: 'Get Task Attachment',
+ description: 'Get the details of one file attached to a task.',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description:
+ 'Read the details (name, content type, size, last modified) of one file attached to a Microsoft To Do task, without its content. Get the attachment ID from List Task Attachments; use Download Task Attachment for the file itself. Read-only.',
+ idempotent: true,
+ },
+ props: {
+ list_id: todoProps.listId(),
+ task_id: todoProps.taskId(),
+ attachment_id: todoProps.attachmentId(),
+ },
+ async run(context) {
+ const { list_id, task_id, attachment_id } = context.propsValue;
+ const client = createTodoClient(context.auth);
+ const attachment: TaskFileAttachment = await client
+ .api(todoApi.attachmentPath({ listId: list_id, taskId: task_id, attachmentId: attachment_id }))
+ .get();
+ return todoApi.toAttachment(attachment);
+ },
+});
diff --git a/packages/pieces/community/microsoft-todo/src/lib/actions/ai/get-task-list.ts b/packages/pieces/community/microsoft-todo/src/lib/actions/ai/get-task-list.ts
new file mode 100644
index 00000000000..64a0df972f6
--- /dev/null
+++ b/packages/pieces/community/microsoft-todo/src/lib/actions/ai/get-task-list.ts
@@ -0,0 +1,30 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { TodoTaskList } from '@microsoft/microsoft-graph-types';
+import { microsoftToDoAuth } from '../../auth';
+import { createTodoClient } from '../../common';
+import { todoApi } from '../../common/todo-api';
+import { todoProps } from '../../common/todo-props';
+import { taskListOutputSchema } from '../../output-schemas';
+
+export const microsoftTodoGetTaskListAction = createAction({
+ auth: microsoftToDoAuth,
+ name: 'microsoft_todo_get_task_list',
+ outputSchema: taskListOutputSchema,
+ displayName: 'Get Task List',
+ description: 'Get one task list by its ID.',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description:
+ 'Read one Microsoft To Do task list (name, owner and sharing flags, built-in list type) by its ID from List Task Lists. Use List Task Lists instead when you only know the name. Read-only.',
+ idempotent: true,
+ },
+ props: {
+ list_id: todoProps.listId(),
+ },
+ async run(context) {
+ const client = createTodoClient(context.auth);
+ const list: TodoTaskList = await client.api(todoApi.listPath({ listId: context.propsValue.list_id })).get();
+ return todoApi.toTaskList(list);
+ },
+});
diff --git a/packages/pieces/community/microsoft-todo/src/lib/actions/ai/get-task.ts b/packages/pieces/community/microsoft-todo/src/lib/actions/ai/get-task.ts
new file mode 100644
index 00000000000..15e176f0e24
--- /dev/null
+++ b/packages/pieces/community/microsoft-todo/src/lib/actions/ai/get-task.ts
@@ -0,0 +1,32 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { TodoTask } from '@microsoft/microsoft-graph-types';
+import { microsoftToDoAuth } from '../../auth';
+import { createTodoClient } from '../../common';
+import { todoApi } from '../../common/todo-api';
+import { todoProps } from '../../common/todo-props';
+import { taskOutputSchema } from '../../output-schemas';
+
+export const microsoftTodoGetTaskAction = createAction({
+ auth: microsoftToDoAuth,
+ name: 'microsoft_todo_get_task',
+ outputSchema: taskOutputSchema,
+ displayName: 'Get Task',
+ description: 'Get one task by its ID.',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description:
+ 'Read one Microsoft To Do task (title, notes, status, importance, dates, categories, recurrence) by its list ID and task ID. Use List Tasks first when you only know the title. Read-only.',
+ idempotent: true,
+ },
+ props: {
+ list_id: todoProps.listId(),
+ task_id: todoProps.taskId(),
+ },
+ async run(context) {
+ const { list_id, task_id } = context.propsValue;
+ const client = createTodoClient(context.auth);
+ const task: TodoTask = await client.api(todoApi.taskPath({ listId: list_id, taskId: task_id })).get();
+ return todoApi.toTask(task);
+ },
+});
diff --git a/packages/pieces/community/microsoft-todo/src/lib/actions/ai/list-checklist-items.ts b/packages/pieces/community/microsoft-todo/src/lib/actions/ai/list-checklist-items.ts
new file mode 100644
index 00000000000..1117815719c
--- /dev/null
+++ b/packages/pieces/community/microsoft-todo/src/lib/actions/ai/list-checklist-items.ts
@@ -0,0 +1,35 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { ChecklistItem } from '@microsoft/microsoft-graph-types';
+import { microsoftToDoAuth } from '../../auth';
+import { createTodoClient } from '../../common';
+import { todoApi } from '../../common/todo-api';
+import { todoProps } from '../../common/todo-props';
+import { microsoftTodoListChecklistItemsOutputSchema } from '../../output-schemas';
+
+export const microsoftTodoListChecklistItemsAction = createAction({
+ auth: microsoftToDoAuth,
+ name: 'microsoft_todo_list_checklist_items',
+ outputSchema: microsoftTodoListChecklistItemsOutputSchema,
+ displayName: 'List Checklist Items',
+ description: 'List the checklist items (steps) of a task.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ 'List every checklist item (the "steps" or subtasks) of one Microsoft To Do task, with their IDs and checked state. Identify the task by list ID and task ID from List Tasks. Read-only.',
+ idempotent: true,
+ },
+ props: {
+ list_id: todoProps.listId(),
+ task_id: todoProps.taskId(),
+ },
+ async run(context) {
+ const { list_id, task_id } = context.propsValue;
+ const items = await todoApi.listAll<ChecklistItem>({
+ client: createTodoClient(context.auth),
+ path: `${todoApi.taskPath({ listId: list_id, taskId: task_id })}/checklistItems`,
+ });
+ const checklistItems = items.map(todoApi.toChecklistItem);
+ return { checklistItems, count: checklistItems.length };
+ },
+});
diff --git a/packages/pieces/community/microsoft-todo/src/lib/actions/ai/list-linked-resources.ts b/packages/pieces/community/microsoft-todo/src/lib/actions/ai/list-linked-resources.ts
new file mode 100644
index 00000000000..2fa12885f87
--- /dev/null
+++ b/packages/pieces/community/microsoft-todo/src/lib/actions/ai/list-linked-resources.ts
@@ -0,0 +1,35 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { LinkedResource } from '@microsoft/microsoft-graph-types';
+import { microsoftToDoAuth } from '../../auth';
+import { createTodoClient } from '../../common';
+import { todoApi } from '../../common/todo-api';
+import { todoProps } from '../../common/todo-props';
+import { microsoftTodoListLinkedResourcesOutputSchema } from '../../output-schemas';
+
+export const microsoftTodoListLinkedResourcesAction = createAction({
+ auth: microsoftToDoAuth,
+ name: 'microsoft_todo_list_linked_resources',
+ outputSchema: microsoftTodoListLinkedResourcesOutputSchema,
+ displayName: 'List Linked Resources',
+ description: 'List the linked resources (source links) of a task.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ 'List the linked resources of one Microsoft To Do task: links back to the item the task came from, such as an email, ticket or web page, with app name, title, URL and external ID. Identify the task by list ID and task ID from List Tasks. Read-only.',
+ idempotent: true,
+ },
+ props: {
+ list_id: todoProps.listId(),
+ task_id: todoProps.taskId(),
+ },
+ async run(context) {
+ const { list_id, task_id } = context.propsValue;
+ const items = await todoApi.listAll<LinkedResource>({
+ client: createTodoClient(context.auth),
+ path: `${todoApi.taskPath({ listId: list_id, taskId: task_id })}/linkedResources`,
+ });
+ const linkedResources = items.map(todoApi.toLinkedResource);
+ return { linkedResources, count: linkedResources.length };
+ },
+});
diff --git a/packages/pieces/community/microsoft-todo/src/lib/actions/ai/list-task-attachments.ts b/packages/pieces/community/microsoft-todo/src/lib/actions/ai/list-task-attachments.ts
new file mode 100644
index 00000000000..5b33efc8bbc
--- /dev/null
+++ b/packages/pieces/community/microsoft-todo/src/lib/actions/ai/list-task-attachments.ts
@@ -0,0 +1,35 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { TaskFileAttachment } from '@microsoft/microsoft-graph-types';
+import { microsoftToDoAuth } from '../../auth';
+import { createTodoClient } from '../../common';
+import { todoApi } from '../../common/todo-api';
+import { todoProps } from '../../common/todo-props';
+import { microsoftTodoListTaskAttachmentsOutputSchema } from '../../output-schemas';
+
+export const microsoftTodoListTaskAttachmentsAction = createAction({
+ auth: microsoftToDoAuth,
+ name: 'microsoft_todo_list_task_attachments',
+ outputSchema: microsoftTodoListTaskAttachmentsOutputSchema,
+ displayName: 'List Task Attachments',
+ description: 'List the files attached to a task.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ 'List the files attached to one Microsoft To Do task with their IDs, names, types and sizes, without their content. Identify the task by list ID and task ID from List Tasks; use Download Task Attachment for a file\'s content. Read-only.',
+ idempotent: true,
+ },
+ props: {
+ list_id: todoProps.listId(),
+ task_id: todoProps.taskId(),
+ },
+ async run(context) {
+ const { list_id, task_id } = context.propsValue;
+ const items = await todoApi.listAll<TaskFileAttachment>({
+ client: createTodoClient(context.auth),
+ path: `${todoApi.taskPath({ listId: list_id, taskId: task_id })}/attachments`,
+ });
+ const attachments = items.map(todoApi.toAttachment);
+ return { attachments, count: attachments.length };
+ },
+});
diff --git a/packages/pieces/community/microsoft-todo/src/lib/actions/ai/list-task-lists.ts b/packages/pieces/community/microsoft-todo/src/lib/actions/ai/list-task-lists.ts
new file mode 100644
index 00000000000..cf139768e32
--- /dev/null
+++ b/packages/pieces/community/microsoft-todo/src/lib/actions/ai/list-task-lists.ts
@@ -0,0 +1,52 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { TodoTaskList } from '@microsoft/microsoft-graph-types';
+import { microsoftToDoAuth } from '../../auth';
+import { createTodoClient } from '../../common';
+import { MATCH_TYPE_OPTIONS, todoApi } from '../../common/todo-api';
+import { todoProps } from '../../common/todo-props';
+import { microsoftTodoListTaskListsOutputSchema } from '../../output-schemas';
+
+export const microsoftTodoListTaskListsAction = createAction({
+ auth: microsoftToDoAuth,
+ name: 'microsoft_todo_list_task_lists',
+ outputSchema: microsoftTodoListTaskListsOutputSchema,
+ displayName: 'List Task Lists',
+ description: 'List the task lists of the connected account, optionally filtered by name.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ 'List the connected user\'s Microsoft To Do task lists with their IDs, optionally filtered by name (contains, starts with or exact match). Use it to resolve a list ID from a name before working with tasks; the built-in "Tasks" list has wellknownListName "defaultList". Returns one page; pass nextPageToken back as Page Token for more.',
+ idempotent: true,
+ },
+ props: {
+ name: Property.ShortText({
+ displayName: 'Name',
+ description: 'Only return lists whose name matches this text.',
+ required: false,
+ }),
+ match_type: Property.StaticDropdown({
+ displayName: 'Match Type',
+ description: 'How Name is matched. Defaults to Contains.',
+ required: false,
+ options: { options: MATCH_TYPE_OPTIONS },
+ }),
+ limit: todoProps.limit(),
+ page_token: todoProps.pageToken(),
+ },
+ async run(context) {
+ const { name, match_type, limit, page_token } = context.propsValue;
+ const trimmedName = name?.trim();
+ const page = await todoApi.listPage<TodoTaskList>({
+ client: createTodoClient(context.auth),
+ path: '/me/todo/lists',
+ top: limit,
+ pageToken: page_token,
+ filter: trimmedName
+ ? todoApi.matchFilter({ field: 'displayName', value: trimmedName, matchType: match_type })
+ : undefined,
+ });
+ const lists = page.items.map(todoApi.toTaskList);
+ return { lists, count: lists.length, nextPageToken: page.nextPageToken };
+ },
+});
diff --git a/packages/pieces/community/microsoft-todo/src/lib/actions/ai/list-tasks.ts b/packages/pieces/community/microsoft-todo/src/lib/actions/ai/list-tasks.ts
new file mode 100644
index 00000000000..b4572e4eaeb
--- /dev/null
+++ b/packages/pieces/community/microsoft-todo/src/lib/actions/ai/list-tasks.ts
@@ -0,0 +1,61 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { TodoTask } from '@microsoft/microsoft-graph-types';
+import { microsoftToDoAuth } from '../../auth';
+import { createTodoClient } from '../../common';
+import { MATCH_TYPE_OPTIONS, TASK_STATUS_OPTIONS, todoApi } from '../../common/todo-api';
+import { todoProps } from '../../common/todo-props';
+import { microsoftTodoListTasksOutputSchema } from '../../output-schemas';
+
+export const microsoftTodoListTasksAction = createAction({
+ auth: microsoftToDoAuth,
+ name: 'microsoft_todo_list_tasks',
+ outputSchema: microsoftTodoListTasksOutputSchema,
+ displayName: 'List Tasks',
+ description: 'List the tasks in a task list, optionally filtered by title and status.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ 'List the tasks in one Microsoft To Do task list (ID from List Task Lists), optionally filtered by title (contains, starts with or exact match) and status. Use it to find a task ID by title before reading, updating, completing or deleting the task. Checklist items, linked resources and attachments are not included; use their own list actions. Returns one page; pass nextPageToken back as Page Token for more.',
+ idempotent: true,
+ },
+ props: {
+ list_id: todoProps.listId(),
+ title: Property.ShortText({
+ displayName: 'Title',
+ description: 'Only return tasks whose title matches this text.',
+ required: false,
+ }),
+ match_type: Property.StaticDropdown({
+ displayName: 'Match Type',
+ description: 'How Title is matched. Defaults to Contains.',
+ required: false,
+ options: { options: MATCH_TYPE_OPTIONS },
+ }),
+ status: Property.StaticDropdown({
+ displayName: 'Status',
+ description: 'Only return tasks with this status.',
+ required: false,
+ options: { options: TASK_STATUS_OPTIONS },
+ }),
+ limit: todoProps.limit(),
+ page_token: todoProps.pageToken(),
+ },
+ async run(context) {
+ const { list_id, title, match_type, status, limit, page_token } = context.propsValue;
+ const trimmedTitle = title?.trim();
+ const filters = [
+ ...(status ? [`status eq '${status}'`] : []),
+ ...(trimmedTitle ? [todoApi.matchFilter({ field: 'title', value: trimmedTitle, matchType: match_type })] : []),
+ ];
+ const page = await todoApi.listPage<TodoTask>({
+ client: createTodoClient(context.auth),
+ path: `${todoApi.listPath({ listId: list_id })}/tasks`,
+ top: limit,
+ pageToken: page_token,
+ filter: filters.length > 0 ? filters.join(' and ') : undefined,
+ });
+ const tasks = page.items.map(todoApi.toTask);
+ return { tasks, count: tasks.length, nextPageToken: page.nextPageToken };
+ },
+});
diff --git a/packages/pieces/community/microsoft-todo/src/lib/actions/ai/move-task.ts b/packages/pieces/community/microsoft-todo/src/lib/actions/ai/move-task.ts
new file mode 100644
index 00000000000..dd9520f22f8
--- /dev/null
+++ b/packages/pieces/community/microsoft-todo/src/lib/actions/ai/move-task.ts
@@ -0,0 +1,136 @@
+import { createAction, Property, tryCatch } from '@activepieces/pieces-framework';
+import { Client } from '@microsoft/microsoft-graph-client';
+import { ChecklistItem, LinkedResource, TodoTask } from '@microsoft/microsoft-graph-types';
+import { microsoftToDoAuth } from '../../auth';
+import { createTodoClient } from '../../common';
+import { todoApi } from '../../common/todo-api';
+import { todoProps } from '../../common/todo-props';
+import { microsoftTodoMoveTaskOutputSchema } from '../../output-schemas';
+
+export const microsoftTodoMoveTaskAction = createAction({
+ auth: microsoftToDoAuth,
+ name: 'microsoft_todo_move_task',
+ outputSchema: microsoftTodoMoveTaskOutputSchema,
+ displayName: 'Move Task to Another List',
+ description: 'Move a task, with its steps and links, to a different task list.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Move a Microsoft To Do task to another list. To Do has no move call, so this copies the task (fields, checklist items, linked resources) into the target list and then deletes the original; the task gets a new ID, returned here. Tasks with attachments are refused so no file is lost, and the original is only deleted if it is unchanged since the copy; otherwise the copy is removed and the move fails. Not idempotent: a retry after success fails because the original is gone.',
+ idempotent: false,
+ },
+ props: {
+ list_id: todoProps.listId(),
+ task_id: todoProps.taskId(),
+ target_list_id: Property.ShortText({
+ displayName: 'Target Task List ID',
+ description: 'ID of the list to move the task to, from List Task Lists.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const listId = context.propsValue.list_id.trim();
+ const taskId = context.propsValue.task_id.trim();
+ const targetListId = context.propsValue.target_list_id.trim();
+ if (listId === targetListId) {
+ throw new Error('The task is already in that list.');
+ }
+ const client = createTodoClient(context.auth);
+ const sourcePath = todoApi.taskPath({ listId, taskId });
+ const source: TodoTask = await client.api(sourcePath).get();
+ if (source.hasAttachments) {
+ throw new Error(
+ 'This task has file attachments, which a move cannot carry over. Download them with Download Task Attachment and re-upload them, or move the task in the To Do app.',
+ );
+ }
+ const checklistItems = await todoApi.listAll<ChecklistItem>({ client, path: `${sourcePath}/checklistItems` });
+ const linkedResources = await todoApi.listAll<LinkedResource>({ client, path: `${sourcePath}/linkedResources` });
+ const created: TodoTask = await client.api(`${todoApi.listPath({ listId: targetListId })}/tasks`).post({
+ title: source.title,
+ body: source.body,
+ importance: source.importance,
+ status: source.status,
+ categories: source.categories,
+ isReminderOn: source.isReminderOn,
+ ...(source.dueDateTime ? { dueDateTime: source.dueDateTime } : {}),
+ ...(source.startDateTime ? { startDateTime: source.startDateTime } : {}),
+ ...(source.reminderDateTime ? { reminderDateTime: source.reminderDateTime } : {}),
+ ...(source.recurrence ? { recurrence: source.recurrence } : {}),
+ linkedResources: linkedResources.map((resource) => ({
+ displayName: resource.displayName,
+ applicationName: resource.applicationName,
+ webUrl: resource.webUrl,
+ externalId: resource.externalId,
+ })),
+ });
+ const newTaskId = created.id ?? '';
+ const newPath = todoApi.taskPath({ listId: targetListId, taskId: newTaskId });
+ const copyResult = await tryCatch(async () => {
+ for (const item of checklistItems) {
+ await client.api(`${newPath}/checklistItems`).post({ displayName: item.displayName, isChecked: item.isChecked });
+ }
+ const latest: TodoTask & { '@odata.etag'?: string } = await client.api(sourcePath).get();
+ if (latest.hasAttachments) {
+ throw new Error('A file was attached to the task while it was being moved.');
+ }
+ return latest['@odata.etag'];
+ });
+ if (copyResult.error) {
+ await rollBackCopy({ client, newPath, newTaskId, targetListId, reason: errorMessage(copyResult.error) });
+ }
+ const deleteCall = client.api(sourcePath);
+ const deleteResult = await tryCatch(() =>
+ (copyResult.data ? deleteCall.header('If-Match', copyResult.data) : deleteCall).delete(),
+ );
+ if (deleteResult.error) {
+ const sourceCheck = await tryCatch(() => client.api(sourcePath).get());
+ if (!sourceCheck.error) {
+ await rollBackCopy({ client, newPath, newTaskId, targetListId, reason: errorMessage(deleteResult.error) });
+ }
+ if (!isNotFound(sourceCheck.error)) {
+ throw new Error(
+ `The task was copied to list ${targetListId} as task ${newTaskId}, but it is unclear whether the original (task ${taskId} in list ${listId}) was deleted: ${errorMessage(deleteResult.error)}. Check the original list and delete one of the two tasks.`,
+ );
+ }
+ }
+ const moved: TodoTask = await client.api(newPath).get();
+ return {
+ ...todoApi.toTask(moved),
+ listId: targetListId,
+ previousListId: listId,
+ previousTaskId: taskId,
+ checklistItemCount: checklistItems.length,
+ linkedResourceCount: linkedResources.length,
+ };
+ },
+});
+
+async function rollBackCopy({
+ client,
+ newPath,
+ newTaskId,
+ targetListId,
+ reason,
+}: {
+ client: Client;
+ newPath: string;
+ newTaskId: string;
+ targetListId: string;
+ reason: string;
+}): Promise<never> {
+ const cleanup = await tryCatch(() => client.api(newPath).delete());
+ throw new Error(
+ cleanup.error
+ ? `The move failed: ${reason} The original task is unchanged, but the partial copy (task ${newTaskId} in list ${targetListId}) could not be removed; delete it before retrying.`
+ : `The move failed and was rolled back; the original task is unchanged. ${reason}`,
+ );
+}
+
+function errorMessage(error: unknown): string {
+ return error instanceof Error ? error.message : String(error);
+}
+
+function isNotFound(error: unknown): boolean {
+ return typeof error === 'object' && error !== null && 'statusCode' in error && error.statusCode === 404;
+}
diff --git a/packages/pieces/community/microsoft-todo/src/lib/actions/ai/search-tasks.ts b/packages/pieces/community/microsoft-todo/src/lib/actions/ai/search-tasks.ts
new file mode 100644
index 00000000000..72bc857f8d5
--- /dev/null
+++ b/packages/pieces/community/microsoft-todo/src/lib/actions/ai/search-tasks.ts
@@ -0,0 +1,104 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { Client, PageCollection } from '@microsoft/microsoft-graph-client';
+import { TodoTask, TodoTaskList } from '@microsoft/microsoft-graph-types';
+import { microsoftToDoAuth } from '../../auth';
+import { createTodoClient } from '../../common';
+import { MATCH_TYPE_OPTIONS, TASK_STATUS_OPTIONS, todoApi } from '../../common/todo-api';
+import { microsoftTodoSearchTasksOutputSchema } from '../../output-schemas';
+
+export const microsoftTodoSearchTasksAction = createAction({
+ auth: microsoftToDoAuth,
+ name: 'microsoft_todo_search_tasks',
+ outputSchema: microsoftTodoSearchTasksOutputSchema,
+ displayName: 'Search Tasks in All Lists',
+ description: 'Find tasks by title and status across every task list.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ 'Search every Microsoft To Do task list for tasks matching a title (contains, starts with or exact match) and/or status, and return each match with its list ID and list name. Use it when you don\'t know which list a task is in; use List Tasks when you do. Stops as soon as Limit matches are found; truncated is then true unless every list was already searched, so more matches may exist. Read-only.',
+ idempotent: true,
+ },
+ props: {
+ title: Property.ShortText({
+ displayName: 'Title',
+ description: 'Only return tasks whose title matches this text.',
+ required: false,
+ }),
+ match_type: Property.StaticDropdown({
+ displayName: 'Match Type',
+ description: 'How Title is matched. Defaults to Contains.',
+ required: false,
+ options: { options: MATCH_TYPE_OPTIONS },
+ }),
+ status: Property.StaticDropdown({
+ displayName: 'Status',
+ description: 'Only return tasks with this status.',
+ required: false,
+ options: { options: TASK_STATUS_OPTIONS },
+ }),
+ limit: Property.Number({
+ displayName: 'Limit',
+ description: 'Maximum number of tasks to return (1-200). Defaults to 50.',
+ required: false,
+ }),
+ },
+ async run(context) {
+ const { title, match_type, status, limit } = context.propsValue;
+ const trimmedTitle = title?.trim();
+ if (!trimmedTitle && !status) {
+ throw new Error('Provide a title, a status, or both to search for.');
+ }
+ const maxResults = Math.min(Math.max(Math.trunc(limit ?? 50), 1), 200);
+ const filter = [
+ ...(status ? [`status eq '${status}'`] : []),
+ ...(trimmedTitle ? [todoApi.matchFilter({ field: 'title', value: trimmedTitle, matchType: match_type })] : []),
+ ].join(' and ');
+ const client = createTodoClient(context.auth);
+ const lists = await todoApi.listAll<TodoTaskList>({ client, path: '/me/todo/lists' });
+ const { tasks, truncated } = await collectMatches({ client, lists, filter, maxResults });
+ return { tasks, count: tasks.length, truncated };
+ },
+});
+
+async function collectMatches({
+ client,
+ lists,
+ filter,
+ maxResults,
+}: {
+ client: Client;
+ lists: TodoTaskList[];
+ filter: string;
+ maxResults: number;
+}): Promise<{ tasks: SearchMatch[]; truncated: boolean }> {
+ const tasks: SearchMatch[] = [];
+ for (const [listIndex, list] of lists.entries()) {
+ if (!list.id) {
+ continue;
+ }
+ let page: PageCollection = await client
+ .api(`${todoApi.listPath({ listId: list.id })}/tasks`)
+ .filter(filter)
+ .top(100)
+ .get();
+ while (true) {
+ const pageTasks: TodoTask[] = page.value;
+ for (const [taskIndex, task] of pageTasks.entries()) {
+ tasks.push({ ...todoApi.toTask(task), listId: list.id, listName: list.displayName ?? null });
+ if (tasks.length >= maxResults) {
+ const searchedEverything =
+ taskIndex === pageTasks.length - 1 && !page['@odata.nextLink'] && listIndex === lists.length - 1;
+ return { tasks, truncated: !searchedEverything };
+ }
+ }
+ if (!page['@odata.nextLink']) {
+ break;
+ }
+ page = await client.api(page['@odata.nextLink']).get();
+ }
+ }
+ return { tasks, truncated: false };
+}
+
+type SearchMatch = ReturnType<typeof todoApi.toTask> & { listId: string; listName: string | null };
diff --git a/packages/pieces/community/microsoft-todo/src/lib/actions/ai/update-checklist-item.ts b/packages/pieces/community/microsoft-todo/src/lib/actions/ai/update-checklist-item.ts
new file mode 100644
index 00000000000..9ca66c4ba1e
--- /dev/null
+++ b/packages/pieces/community/microsoft-todo/src/lib/actions/ai/update-checklist-item.ts
@@ -0,0 +1,58 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { ChecklistItem } from '@microsoft/microsoft-graph-types';
+import { microsoftToDoAuth } from '../../auth';
+import { createTodoClient } from '../../common';
+import { todoApi } from '../../common/todo-api';
+import { todoProps } from '../../common/todo-props';
+import { checklistItemOutputSchema } from '../../output-schemas';
+
+export const microsoftTodoUpdateChecklistItemAction = createAction({
+ auth: microsoftToDoAuth,
+ name: 'microsoft_todo_update_checklist_item',
+ outputSchema: checklistItemOutputSchema,
+ displayName: 'Update Checklist Item',
+ description: 'Change the text or checked state of a checklist item.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Change the text and/or checked state of one checklist item (step) of a Microsoft To Do task; use it to check off or uncheck a step. Get the checklist item ID from List Checklist Items. Fields left empty keep their values.',
+ idempotent: true,
+ },
+ props: {
+ list_id: todoProps.listId(),
+ task_id: todoProps.taskId(),
+ checklist_item_id: todoProps.checklistItemId(),
+ display_name: Property.ShortText({
+ displayName: 'Text',
+ description: 'New text for the checklist item.',
+ required: false,
+ }),
+ is_checked: Property.StaticDropdown({
+ displayName: 'Checked',
+ description: 'Check or uncheck the item. Leave empty to keep it as is.',
+ required: false,
+ options: {
+ options: [
+ { label: 'Yes', value: 'yes' },
+ { label: 'No', value: 'no' },
+ ],
+ },
+ }),
+ },
+ async run(context) {
+ const { list_id, task_id, checklist_item_id, display_name, is_checked } = context.propsValue;
+ const patch: ChecklistItem = {
+ ...(display_name !== undefined ? { displayName: display_name } : {}),
+ ...(is_checked ? { isChecked: is_checked === 'yes' } : {}),
+ };
+ if (Object.keys(patch).length === 0) {
+ throw new Error('Provide new text, a checked state, or both.');
+ }
+ const client = createTodoClient(context.auth);
+ const item: ChecklistItem = await client
+ .api(todoApi.checklistItemPath({ listId: list_id, taskId: task_id, checklistItemId: checklist_item_id }))
+ .update(patch);
+ return todoApi.toChecklistItem(item);
+ },
+});
diff --git a/packages/pieces/community/microsoft-todo/src/lib/actions/ai/update-linked-resource.ts b/packages/pieces/community/microsoft-todo/src/lib/actions/ai/update-linked-resource.ts
new file mode 100644
index 00000000000..2a2300a41c3
--- /dev/null
+++ b/packages/pieces/community/microsoft-todo/src/lib/actions/ai/update-linked-resource.ts
@@ -0,0 +1,61 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { LinkedResource } from '@microsoft/microsoft-graph-types';
+import { microsoftToDoAuth } from '../../auth';
+import { createTodoClient } from '../../common';
+import { todoApi } from '../../common/todo-api';
+import { todoProps } from '../../common/todo-props';
+import { linkedResourceOutputSchema } from '../../output-schemas';
+
+export const microsoftTodoUpdateLinkedResourceAction = createAction({
+ auth: microsoftToDoAuth,
+ name: 'microsoft_todo_update_linked_resource',
+ outputSchema: linkedResourceOutputSchema,
+ displayName: 'Update Linked Resource',
+ description: 'Change the title, app name, URL or external ID of a linked resource.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Change one or more fields of a linked resource on a Microsoft To Do task. Get the linked resource ID from List Linked Resources. Fields left empty keep their values.',
+ idempotent: true,
+ },
+ props: {
+ list_id: todoProps.listId(),
+ task_id: todoProps.taskId(),
+ linked_resource_id: todoProps.linkedResourceId(),
+ display_name: Property.ShortText({
+ displayName: 'Title',
+ required: false,
+ }),
+ application_name: Property.ShortText({
+ displayName: 'Application Name',
+ required: false,
+ }),
+ web_url: Property.ShortText({
+ displayName: 'URL',
+ required: false,
+ }),
+ external_id: Property.ShortText({
+ displayName: 'External ID',
+ required: false,
+ }),
+ },
+ async run(context) {
+ const { list_id, task_id, linked_resource_id, display_name, application_name, web_url, external_id } =
+ context.propsValue;
+ const patch: LinkedResource = {
+ ...(display_name !== undefined ? { displayName: display_name } : {}),
+ ...(application_name !== undefined ? { applicationName: application_name } : {}),
+ ...(web_url !== undefined ? { webUrl: web_url } : {}),
+ ...(external_id !== undefined ? { externalId: external_id } : {}),
+ };
+ if (Object.keys(patch).length === 0) {
+ throw new Error('Provide at least one field to change.');
+ }
+ const client = createTodoClient(context.auth);
+ const resource: LinkedResource = await client
+ .api(todoApi.linkedResourcePath({ listId: list_id, taskId: task_id, linkedResourceId: linked_resource_id }))
+ .update(patch);
+ return todoApi.toLinkedResource(resource);
+ },
+});
diff --git a/packages/pieces/community/microsoft-todo/src/lib/actions/ai/update-task-list.ts b/packages/pieces/community/microsoft-todo/src/lib/actions/ai/update-task-list.ts
new file mode 100644
index 00000000000..00c5c95f2a6
--- /dev/null
+++ b/packages/pieces/community/microsoft-todo/src/lib/actions/ai/update-task-list.ts
@@ -0,0 +1,38 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { TodoTaskList } from '@microsoft/microsoft-graph-types';
+import { microsoftToDoAuth } from '../../auth';
+import { createTodoClient } from '../../common';
+import { todoApi } from '../../common/todo-api';
+import { todoProps } from '../../common/todo-props';
+import { taskListOutputSchema } from '../../output-schemas';
+
+export const microsoftTodoUpdateTaskListAction = createAction({
+ auth: microsoftToDoAuth,
+ name: 'microsoft_todo_update_task_list',
+ outputSchema: taskListOutputSchema,
+ displayName: 'Rename Task List',
+ description: 'Rename a task list.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Rename a Microsoft To Do task list, identified by its ID from List Task Lists. The built-in "Tasks" and "Flagged email" lists cannot be renamed. Setting the same name again changes nothing.',
+ idempotent: true,
+ },
+ props: {
+ list_id: todoProps.listId(),
+ display_name: Property.ShortText({
+ displayName: 'New Name',
+ description: 'The new name for the task list.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const { list_id, display_name } = context.propsValue;
+ const client = createTodoClient(context.auth);
+ const list: TodoTaskList = await client
+ .api(todoApi.listPath({ listId: list_id }))
+ .update({ displayName: display_name });
+ return todoApi.toTaskList(list);
+ },
+});
diff --git a/packages/pieces/community/microsoft-todo/src/lib/actions/ai/update-task.ts b/packages/pieces/community/microsoft-todo/src/lib/actions/ai/update-task.ts
new file mode 100644
index 00000000000..23002bd7e82
--- /dev/null
+++ b/packages/pieces/community/microsoft-todo/src/lib/actions/ai/update-task.ts
@@ -0,0 +1,134 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { TodoTask } from '@microsoft/microsoft-graph-types';
+import { microsoftToDoAuth } from '../../auth';
+import { createTodoClient } from '../../common';
+import { IMPORTANCE_OPTIONS, TASK_STATUS_OPTIONS, todoApi } from '../../common/todo-api';
+import { todoProps } from '../../common/todo-props';
+import { taskOutputSchema } from '../../output-schemas';
+
+export const microsoftTodoUpdateTaskAction = createAction({
+ auth: microsoftToDoAuth,
+ name: 'microsoft_todo_update_task',
+ outputSchema: taskOutputSchema,
+ displayName: 'Update Task',
+ description: 'Change fields of an existing task.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Change one or more fields of a Microsoft To Do task, identified by list ID and task ID (from List Tasks). Only the fields you provide change; the rest keep their values. To remove a due date, start date, reminder, notes or categories, pick it in Clear Fields (not together with a new value for the same field). Times are UTC. Use Complete Task to just mark it done.',
+ idempotent: true,
+ },
+ props: {
+ list_id: todoProps.listId(),
+ task_id: todoProps.taskId(),
+ title: Property.ShortText({
+ displayName: 'Title',
+ description: 'New title.',
+ required: false,
+ }),
+ body: Property.LongText({
+ displayName: 'Notes',
+ description: 'New plain-text notes, replacing the current ones.',
+ required: false,
+ }),
+ importance: Property.StaticDropdown({
+ displayName: 'Importance',
+ required: false,
+ options: { options: IMPORTANCE_OPTIONS },
+ }),
+ status: Property.StaticDropdown({
+ displayName: 'Status',
+ required: false,
+ options: { options: TASK_STATUS_OPTIONS },
+ }),
+ due_date_time: Property.DateTime({
+ displayName: 'Due Date',
+ description: 'New due date, in UTC.',
+ required: false,
+ }),
+ start_date_time: Property.DateTime({
+ displayName: 'Start Date',
+ description: 'New start date, in UTC.',
+ required: false,
+ }),
+ reminder_date_time: Property.DateTime({
+ displayName: 'Reminder',
+ description: 'New reminder time, in UTC. Turns the reminder on.',
+ required: false,
+ }),
+ categories: Property.Array({
+ displayName: 'Categories',
+ description: 'Category names, replacing the current ones.',
+ required: false,
+ }),
+ clear_fields: Property.StaticMultiSelectDropdown({
+ displayName: 'Clear Fields',
+ description: 'Fields to empty on the task.',
+ required: false,
+ options: {
+ options: [
+ { label: 'Due Date', value: 'dueDateTime' },
+ { label: 'Start Date', value: 'startDateTime' },
+ { label: 'Reminder', value: 'reminderDateTime' },
+ { label: 'Notes', value: 'body' },
+ { label: 'Categories', value: 'categories' },
+ ],
+ },
+ }),
+ },
+ async run(context) {
+ const {
+ list_id,
+ task_id,
+ title,
+ body,
+ importance,
+ status,
+ due_date_time,
+ start_date_time,
+ reminder_date_time,
+ categories,
+ clear_fields,
+ } = context.propsValue;
+ const clear = clear_fields ?? [];
+ const conflicts = [
+ { field: 'dueDateTime', value: due_date_time },
+ { field: 'startDateTime', value: start_date_time },
+ { field: 'reminderDateTime', value: reminder_date_time },
+ { field: 'body', value: body },
+ { field: 'categories', value: categories },
+ ].filter(({ field, value }) => clear.includes(field) && value !== undefined);
+ if (conflicts.length > 0) {
+ throw new Error(
+ `Cannot both set and clear: ${conflicts.map((c) => c.field).join(', ')}. Provide a value or clear it, not both.`,
+ );
+ }
+ const reminder = todoApi.toDateTimeTimeZone(reminder_date_time);
+ const patch: TodoTask = {
+ ...(title !== undefined ? { title } : {}),
+ ...(body !== undefined ? { body: { content: body, contentType: 'text' } } : {}),
+ ...(importance ? { importance: todoApi.toImportance(importance) } : {}),
+ ...(status ? { status: todoApi.toStatus(status) } : {}),
+ ...(due_date_time ? { dueDateTime: todoApi.toDateTimeTimeZone(due_date_time) } : {}),
+ ...(start_date_time ? { startDateTime: todoApi.toDateTimeTimeZone(start_date_time) } : {}),
+ ...(reminder ? { reminderDateTime: reminder, isReminderOn: true } : {}),
+ ...(categories !== undefined
+ ? { categories: categories.filter((c): c is string => typeof c === 'string') }
+ : {}),
+ ...(clear.includes('dueDateTime') ? { dueDateTime: null } : {}),
+ ...(clear.includes('startDateTime') ? { startDateTime: null } : {}),
+ ...(clear.includes('reminderDateTime') ? { reminderDateTime: null, isReminderOn: false } : {}),
+ ...(clear.includes('body') ? { body: { content: '', contentType: 'text' } } : {}),
+ ...(clear.includes('categories') ? { categories: [] } : {}),
+ };
+ if (Object.keys(patch).length === 0) {
+ throw new Error('Provide at least one field to change or clear.');
+ }
+ const client = createTodoClient(context.auth);
+ const updated: TodoTask = await client
+ .api(todoApi.taskPath({ listId: list_id, taskId: task_id }))
+ .update(patch);
+ return todoApi.toTask(updated);
+ },
+});
diff --git a/packages/pieces/community/microsoft-todo/src/lib/actions/ai/upload-task-attachment.ts b/packages/pieces/community/microsoft-todo/src/lib/actions/ai/upload-task-attachment.ts
new file mode 100644
index 00000000000..4f07273ad0b
--- /dev/null
+++ b/packages/pieces/community/microsoft-todo/src/lib/actions/ai/upload-task-attachment.ts
@@ -0,0 +1,93 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { Client } from '@microsoft/microsoft-graph-client';
+import { TaskFileAttachment } from '@microsoft/microsoft-graph-types';
+import { microsoftToDoAuth } from '../../auth';
+import { createTodoClient } from '../../common';
+import { todoApi } from '../../common/todo-api';
+import { todoProps } from '../../common/todo-props';
+import { attachmentOutputSchema } from '../../output-schemas';
+
+export const microsoftTodoUploadTaskAttachmentAction = createAction({
+ auth: microsoftToDoAuth,
+ name: 'microsoft_todo_upload_task_attachment',
+ outputSchema: attachmentOutputSchema,
+ displayName: 'Upload Task Attachment',
+ description: 'Attach a file (up to 25 MB) to a task.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Attach a file of up to 25 MB to a Microsoft To Do task, identified by list ID and task ID from List Tasks. Files under 3 MB are sent in one request and larger ones through an upload session. Not idempotent: every call adds another attachment, even for the same file.',
+ idempotent: false,
+ },
+ props: {
+ list_id: todoProps.listId(),
+ task_id: todoProps.taskId(),
+ file: Property.File({
+ displayName: 'File',
+ description: 'The file to attach, up to 25 MB.',
+ required: true,
+ }),
+ file_name: Property.ShortText({
+ displayName: 'File Name',
+ description: 'Name shown for the attachment. Defaults to the file\'s own name.',
+ required: false,
+ }),
+ },
+ async run(context) {
+ const { list_id, task_id, file, file_name } = context.propsValue;
+ const size = file.data.length;
+ if (size > MAX_BYTES) {
+ throw new Error(`The file is ${(size / MB).toFixed(2)} MB; Microsoft To Do accepts attachments up to 25 MB.`);
+ }
+ const name = file_name?.trim() || file.filename;
+ const client = createTodoClient(context.auth);
+ const attachmentsPath = `${todoApi.taskPath({ listId: list_id, taskId: task_id })}/attachments`;
+ if (size < INLINE_LIMIT_BYTES) {
+ const attachment: TaskFileAttachment = await client.api(attachmentsPath).post({
+ '@odata.type': '#microsoft.graph.taskFileAttachment',
+ name,
+ contentBytes: file.data.toString('base64'),
+ contentType: 'application/octet-stream',
+ });
+ return todoApi.toAttachment(attachment);
+ }
+ const uploaded = await uploadInChunks({ client, attachmentsPath, name, data: file.data });
+ return todoApi.toAttachment(uploaded ?? { name, size });
+ },
+});
+
+async function uploadInChunks({
+ client,
+ attachmentsPath,
+ name,
+ data,
+}: {
+ client: Client;
+ attachmentsPath: string;
+ name: string;
+ data: Buffer;
+}): Promise<TaskFileAttachment | undefined> {
+ const session = await client.api(`${attachmentsPath}/createUploadSession`).post({
+ attachmentInfo: { attachmentType: 'file', name, size: data.length },
+ });
+ let response: TaskFileAttachment | undefined;
+ for (let start = 0; start < data.length; start += CHUNK_BYTES) {
+ const end = Math.min(start + CHUNK_BYTES, data.length);
+ const chunk = data.subarray(start, end);
+ response = await client
+ .api(session.uploadUrl)
+ .headers({
+ 'Content-Length': chunk.length.toString(),
+ 'Content-Range': `bytes ${start}-${end - 1}/${data.length}`,
+ 'Content-Type': 'application/octet-stream',
+ })
+ .put(chunk);
+ }
+ return response;
+}
+
+const MB = 1024 * 1024;
+const MAX_BYTES = 25 * MB;
+const INLINE_LIMIT_BYTES = 3 * MB;
+const CHUNK_BYTES = 4 * MB;
diff --git a/packages/pieces/community/microsoft-todo/src/lib/actions/complete-task.ts b/packages/pieces/community/microsoft-todo/src/lib/actions/complete-task.ts
index 6025db80d74..010f156ffdf 100644
--- a/packages/pieces/community/microsoft-todo/src/lib/actions/complete-task.ts
+++ b/packages/pieces/community/microsoft-todo/src/lib/actions/complete-task.ts
@@ -2,14 +2,16 @@ import { Property, createAction, OAuth2PropertyValue } from '@activepieces/piece
import { getTaskListsDropdown, getIncompleteTasksInListDropdown, createTodoClient } from '../common';
import { microsoftToDoAuth } from '../auth';
import { TodoTask } from '@microsoft/microsoft-graph-types';
+import { completeTaskOutputSchema } from '../output-schemas';
export const completeTaskAction = createAction({
auth: microsoftToDoAuth,
name: 'complete_task',
+ outputSchema: completeTaskOutputSchema,
classification: 'WRITE',
displayName: 'Complete Task',
description: 'Marks a task as completed.',
- audience: 'both',
+ audience: 'human',
aiMetadata: { description: 'Mark a specific Microsoft To Do task as completed, setting its status to completed and stamping a completion time. Use when a task should be closed out; identify it by task list id and task id (resolve via list/find actions). Idempotent in effect — completing an already-completed task leaves it completed, though it refreshes the completion timestamp.', idempotent: true },
props: {
task_list_id: Property.Dropdown({
diff --git a/packages/pieces/community/microsoft-todo/src/lib/actions/create-task-list.ts b/packages/pieces/community/microsoft-todo/src/lib/actions/create-task-list.ts
index 3c17366125e..ca41fb29e42 100644
--- a/packages/pieces/community/microsoft-todo/src/lib/actions/create-task-list.ts
+++ b/packages/pieces/community/microsoft-todo/src/lib/actions/create-task-list.ts
@@ -1,14 +1,16 @@
import { Property, createAction } from '@activepieces/pieces-framework';
import { microsoftToDoAuth } from '../auth';
import { createTodoClient } from '../common';
+import { taskListOutputSchema } from '../output-schemas';
export const createTaskListAction = createAction({
auth: microsoftToDoAuth,
name: 'create_task_list',
+ outputSchema: taskListOutputSchema,
classification: 'WRITE',
displayName: 'Create Task List',
description: 'Create a new task list.',
- audience: 'both',
+ audience: 'human',
aiMetadata: { description: 'Create a new Microsoft To Do task list (a named container for tasks) for the authenticated user. Use when a task needs to live in a list that does not yet exist. Not idempotent — repeating the call creates another list with the same name rather than reusing the existing one.', idempotent: false },
props: {
displayName: Property.ShortText({
diff --git a/packages/pieces/community/microsoft-todo/src/lib/actions/create-task.ts b/packages/pieces/community/microsoft-todo/src/lib/actions/create-task.ts
index 457aea3e2c5..057263f4c18 100644
--- a/packages/pieces/community/microsoft-todo/src/lib/actions/create-task.ts
+++ b/packages/pieces/community/microsoft-todo/src/lib/actions/create-task.ts
@@ -2,14 +2,16 @@ import { Property, createAction, OAuth2PropertyValue } from '@activepieces/piece
import { getTaskListsDropdown, createTodoClient } from '../common';
import { microsoftToDoAuth } from '../auth';
import { Importance, TaskStatus, TodoTask } from '@microsoft/microsoft-graph-types';
+import { createTaskOutputSchema } from '../output-schemas';
export const createTask = createAction({
auth: microsoftToDoAuth,
name: 'create_task',
+ outputSchema: createTaskOutputSchema,
classification: 'WRITE',
displayName: 'Create Task',
description: 'Creates a new task.',
- audience: 'both',
+ audience: 'human',
aiMetadata: { description: 'Create a new to-do task inside a specific Microsoft To Do task list, optionally setting title, body/notes, importance, status, due/reminder/start dates, and categories. Use to add an item to a user\'s list; requires a target task list id (resolve via the list-tasks/find actions if you only have a name). Not idempotent — each call appends a new task even with identical input.', idempotent: false },
props: {
task_list_id: Property.Dropdown({
diff --git a/packages/pieces/community/microsoft-todo/src/lib/actions/delete-task.ts b/packages/pieces/community/microsoft-todo/src/lib/actions/delete-task.ts
index 271fe60b7ef..61a4fd4e1c6 100644
--- a/packages/pieces/community/microsoft-todo/src/lib/actions/delete-task.ts
+++ b/packages/pieces/community/microsoft-todo/src/lib/actions/delete-task.ts
@@ -1,14 +1,16 @@
import { Property, createAction, OAuth2PropertyValue } from '@activepieces/pieces-framework';
import { getTaskListsDropdown, getTasksInListDropdown, createTodoClient } from '../common';
import { microsoftToDoAuth } from '../auth';
+import { deleteTaskOutputSchema } from '../output-schemas';
export const deleteTaskAction = createAction({
auth: microsoftToDoAuth,
name: 'delete_task',
+ outputSchema: deleteTaskOutputSchema,
classification: 'DESTRUCTIVE',
displayName: 'Delete Task',
description: 'Deletes an existing task.',
- audience: 'both',
+ audience: 'human',
aiMetadata: { description: 'Permanently delete a specific Microsoft To Do task identified by its task list id and task id. Use to remove a task; resolve the task id first via list/find actions. Idempotent on the end state (the task ends up gone), but destructive and irreversible — a repeat call on an already-deleted task will error.', idempotent: true },
props: {
task_list_id: Property.Dropdown({
diff --git a/packages/pieces/community/microsoft-todo/src/lib/actions/find-task-by-title.ts b/packages/pieces/community/microsoft-todo/src/lib/actions/find-task-by-title.ts
index 9225648bf9a..27f5ac116e2 100644
--- a/packages/pieces/community/microsoft-todo/src/lib/actions/find-task-by-title.ts
+++ b/packages/pieces/community/microsoft-todo/src/lib/actions/find-task-by-title.ts
@@ -4,14 +4,16 @@ import { microsoftToDoAuth } from '../auth';
import { PageCollection } from '@microsoft/microsoft-graph-client';
import { TodoTask } from '@microsoft/microsoft-graph-types';
+import { findTaskByTitleOutputSchema } from '../output-schemas';
export const findTaskByTitleAction = createAction({
auth: microsoftToDoAuth,
name: 'find_task_by_title',
+ outputSchema: findTaskByTitleOutputSchema,
classification: 'SEARCH',
displayName: 'Find Task',
description: 'Finds tasks by title.',
- audience: 'both',
+ audience: 'human',
aiMetadata: { description: 'Search a specific Microsoft To Do task list for tasks whose title matches the given text and return all matches. The match mode is configurable — contains (default), starts-with, or exact. Use to resolve a task id from its title before reading, updating, completing, or deleting it. Requires a task list id; read-only and idempotent.', idempotent: true },
props: {
task_list_id: Property.Dropdown({
diff --git a/packages/pieces/community/microsoft-todo/src/lib/actions/find-task-list-by-name.ts b/packages/pieces/community/microsoft-todo/src/lib/actions/find-task-list-by-name.ts
index c1c9c175521..d221615ce2c 100644
--- a/packages/pieces/community/microsoft-todo/src/lib/actions/find-task-list-by-name.ts
+++ b/packages/pieces/community/microsoft-todo/src/lib/actions/find-task-list-by-name.ts
@@ -3,14 +3,16 @@ import { microsoftToDoAuth } from '../auth';
import { PageCollection } from '@microsoft/microsoft-graph-client';
import { createTodoClient } from '../common';
import { TodoTaskList } from '@microsoft/microsoft-graph-types';
+import { findTaskListByNameOutputSchema } from '../output-schemas';
export const findTaskListByNameAction = createAction({
auth: microsoftToDoAuth,
name: 'find_task_list_by_name',
+ outputSchema: findTaskListByNameOutputSchema,
classification: 'SEARCH',
displayName: 'Find Task List',
description: 'Finds a task list by its name.',
- audience: 'both',
+ audience: 'human',
aiMetadata: { description: 'Search the authenticated user\'s Microsoft To Do task lists by display name and return all matches. The match mode is configurable — contains (default), starts-with, or exact — so you can do a loose lookup or pin down one list. Use to resolve a list id from a name before acting on it. Read-only and idempotent.', idempotent: true },
props: {
name: Property.ShortText({
diff --git a/packages/pieces/community/microsoft-todo/src/lib/actions/get-task.ts b/packages/pieces/community/microsoft-todo/src/lib/actions/get-task.ts
index 11ed566342d..618ffa75f85 100644
--- a/packages/pieces/community/microsoft-todo/src/lib/actions/get-task.ts
+++ b/packages/pieces/community/microsoft-todo/src/lib/actions/get-task.ts
@@ -2,14 +2,16 @@ import { Property, createAction, OAuth2PropertyValue } from '@activepieces/piece
import { getTaskListsDropdown, getTasksInListDropdown, createTodoClient } from '../common';
import { microsoftToDoAuth } from '../auth';
import { TodoTask } from '@microsoft/microsoft-graph-types';
+import { createTaskOutputSchema } from '../output-schemas';
export const getTaskAction = createAction({
auth: microsoftToDoAuth,
name: 'get_task',
+ outputSchema: createTaskOutputSchema,
classification: 'READ',
displayName: 'Get Task',
description: 'Gets the details of a specific task.',
- audience: 'both',
+ audience: 'human',
aiMetadata: { description: 'Retrieve the full details of a single Microsoft To Do task by its task list id and task id. Use when you already know the exact task and need its current fields (title, status, dates, etc.). Read-only and idempotent.', idempotent: true },
props: {
task_list_id: Property.Dropdown({
diff --git a/packages/pieces/community/microsoft-todo/src/lib/actions/list-task-lists.ts b/packages/pieces/community/microsoft-todo/src/lib/actions/list-task-lists.ts
index 115bde95f69..b6e1879c292 100644
--- a/packages/pieces/community/microsoft-todo/src/lib/actions/list-task-lists.ts
+++ b/packages/pieces/community/microsoft-todo/src/lib/actions/list-task-lists.ts
@@ -3,14 +3,16 @@ import { getGraphBaseUrl } from '../common/microsoft-cloud';
import { microsoftToDoAuth } from '../auth';
import { Client, PageCollection } from '@microsoft/microsoft-graph-client';
import { TodoTaskList } from '@microsoft/microsoft-graph-types';
+import { listTaskListsOutputSchema } from '../output-schemas';
export const listTaskListsAction = createAction({
auth: microsoftToDoAuth,
name: 'list_task_lists',
+ outputSchema: listTaskListsOutputSchema,
classification: 'SEARCH',
displayName: 'List Task Lists',
description: 'Returns a list of all task lists.',
- audience: 'both',
+ audience: 'human',
aiMetadata: { description: 'List all of the authenticated user\'s Microsoft To Do task lists, paging through all results. Use to discover available lists or to resolve a list id before creating, reading, or filtering tasks. Takes no input. Read-only and idempotent.', idempotent: true },
props: {},
async run(context) {
diff --git a/packages/pieces/community/microsoft-todo/src/lib/actions/list-tasks.ts b/packages/pieces/community/microsoft-todo/src/lib/actions/list-tasks.ts
index 639cdd7c5d3..dd2ce6c3aff 100644
--- a/packages/pieces/community/microsoft-todo/src/lib/actions/list-tasks.ts
+++ b/packages/pieces/community/microsoft-todo/src/lib/actions/list-tasks.ts
@@ -4,14 +4,16 @@ import { microsoftToDoAuth } from '../auth';
import { getTaskListsDropdown } from '../common';
import { Client, PageCollection } from '@microsoft/microsoft-graph-client';
import { TodoTask } from '@microsoft/microsoft-graph-types';
+import { listTasksOutputSchema } from '../output-schemas';
export const listTasksAction = createAction({
auth: microsoftToDoAuth,
name: 'list_tasks',
+ outputSchema: listTasksOutputSchema,
classification: 'SEARCH',
displayName: 'List Tasks',
description: 'Returns a list of all tasks in a specific list.',
- audience: 'both',
+ audience: 'human',
aiMetadata: { description: 'List the tasks in a given Microsoft To Do task list, paging through all results. Optionally narrow by a title substring and/or a status filter (not started, in progress, completed, waiting on others, deferred); with no filters it returns every task in the list. Use to enumerate or browse a list\'s contents. Read-only and idempotent. Requires a task list id.', idempotent: true },
props: {
task_list_id: Property.Dropdown({
diff --git a/packages/pieces/community/microsoft-todo/src/lib/actions/update-task-list.ts b/packages/pieces/community/microsoft-todo/src/lib/actions/update-task-list.ts
index 48174d8c631..0d4b35d6c2b 100644
--- a/packages/pieces/community/microsoft-todo/src/lib/actions/update-task-list.ts
+++ b/packages/pieces/community/microsoft-todo/src/lib/actions/update-task-list.ts
@@ -2,14 +2,16 @@ import { Property, createAction, OAuth2PropertyValue } from '@activepieces/piece
import { getTaskListsDropdown, createTodoClient } from '../common';
import { microsoftToDoAuth } from '../auth';
import { TodoTaskList } from '@microsoft/microsoft-graph-types';
+import { taskListOutputSchema } from '../output-schemas';
export const updateTaskListAction = createAction({
auth: microsoftToDoAuth,
name: 'update_task_list',
+ outputSchema: taskListOutputSchema,
classification: 'WRITE',
displayName: 'Update Task List',
description: 'Updates an existing task list.',
- audience: 'both',
+ audience: 'human',
aiMetadata: { description: 'Rename an existing Microsoft To Do task list, identified by its task list id, to a new display name. Use to change a list\'s title. Idempotent: re-sending the same name leaves the list in the same state. The new name is required and cannot be empty.', idempotent: true },
props: {
task_list_id: Property.Dropdown({
diff --git a/packages/pieces/community/microsoft-todo/src/lib/actions/update-task.ts b/packages/pieces/community/microsoft-todo/src/lib/actions/update-task.ts
index ca89e8c48c9..c30581821c1 100644
--- a/packages/pieces/community/microsoft-todo/src/lib/actions/update-task.ts
+++ b/packages/pieces/community/microsoft-todo/src/lib/actions/update-task.ts
@@ -2,14 +2,16 @@ import { Property, createAction, OAuth2PropertyValue } from '@activepieces/piece
import { getTaskListsDropdown, getTasksInListDropdown, createTodoClient } from '../common';
import { microsoftToDoAuth } from '../auth';
import { Importance, TaskStatus, TodoTask } from '@microsoft/microsoft-graph-types';
+import { createTaskOutputSchema } from '../output-schemas';
export const updateTaskAction = createAction({
auth: microsoftToDoAuth,
name: 'update_task',
+ outputSchema: createTaskOutputSchema,
classification: 'WRITE',
displayName: 'Update Task',
description: 'Update an existing task.',
- audience: 'both',
+ audience: 'human',
aiMetadata: { description: 'Update fields of an existing Microsoft To Do task identified by its task list id and task id — title, body/notes, importance, status, due/reminder/start dates, or categories. Use to edit an already-created task; resolve the task id first via list/find actions. Idempotent in effect: re-sending the same field values converges the task to that state without additional side effects.', idempotent: true },
props: {
task_list_id: Property.Dropdown({
diff --git a/packages/pieces/community/microsoft-todo/src/lib/common/todo-api.ts b/packages/pieces/community/microsoft-todo/src/lib/common/todo-api.ts
new file mode 100644
index 00000000000..a9595985eec
--- /dev/null
+++ b/packages/pieces/community/microsoft-todo/src/lib/common/todo-api.ts
@@ -0,0 +1,256 @@
+import { Client, PageCollection } from '@microsoft/microsoft-graph-client';
+import {
+ ChecklistItem,
+ DateTimeTimeZone,
+ Importance,
+ LinkedResource,
+ TaskStatus,
+ TaskFileAttachment,
+ TodoTask,
+ TodoTaskList,
+} from '@microsoft/microsoft-graph-types';
+
+async function listPage<T>({
+ client,
+ path,
+ top,
+ filter,
+ pageToken,
+}: {
+ client: Client;
+ path: string;
+ top: number | undefined;
+ filter?: string;
+ pageToken?: string;
+}): Promise<{ items: T[]; nextPageToken: string | null }> {
+ const token = pageToken?.trim();
+ if (token) {
+ assertPageTokenMatches({ token, path, filter });
+ const page: PageCollection = await client.api(token).get();
+ return { items: page.value, nextPageToken: page['@odata.nextLink'] ?? null };
+ }
+ let call = client.api(path).top(clampTop(top));
+ if (filter) {
+ call = call.filter(filter);
+ }
+ const page: PageCollection = await call.get();
+ return { items: page.value, nextPageToken: page['@odata.nextLink'] ?? null };
+}
+
+function assertPageTokenMatches({ token, path, filter }: { token: string; path: string; filter?: string }): void {
+ const url = parseUrl(token);
+ const tokenPath = url ? decodeURIComponent(url.pathname) : '';
+ const tokenFilter = url?.searchParams.get('$filter') ?? '';
+ const matches =
+ url !== null &&
+ tokenPath.endsWith(decodeURIComponent(path)) &&
+ tokenFilter.trim() === (filter ?? '').trim();
+ if (!matches) {
+ throw new Error(
+ 'This page token belongs to a different list or filter. Pass the nextPageToken from the previous call with the same inputs, or leave Page Token empty to start over.',
+ );
+ }
+}
+
+function parseUrl(value: string): URL | null {
+ try {
+ return new URL(value);
+ } catch {
+ return null;
+ }
+}
+
+async function listAll<T>({ client, path }: { client: Client; path: string }): Promise<T[]> {
+ const items: T[] = [];
+ let response: PageCollection = await client.api(path).get();
+ while (response.value.length > 0) {
+ items.push(...response.value);
+ if (!response['@odata.nextLink']) {
+ break;
+ }
+ response = await client.api(response['@odata.nextLink']).get();
+ }
+ return items;
+}
+
+function listPath({ listId }: { listId: string }): string {
+ return `/me/todo/lists/${encodeURIComponent(listId.trim())}`;
+}
+
+function taskPath({ listId, taskId }: { listId: string; taskId: string }): string {
+ return `${listPath({ listId })}/tasks/${encodeURIComponent(taskId.trim())}`;
+}
+
+function checklistItemPath({
+ listId,
+ taskId,
+ checklistItemId,
+}: {
+ listId: string;
+ taskId: string;
+ checklistItemId: string;
+}): string {
+ return `${taskPath({ listId, taskId })}/checklistItems/${encodeURIComponent(checklistItemId.trim())}`;
+}
+
+function linkedResourcePath({
+ listId,
+ taskId,
+ linkedResourceId,
+}: {
+ listId: string;
+ taskId: string;
+ linkedResourceId: string;
+}): string {
+ return `${taskPath({ listId, taskId })}/linkedResources/${encodeURIComponent(linkedResourceId.trim())}`;
+}
+
+function attachmentPath({
+ listId,
+ taskId,
+ attachmentId,
+}: {
+ listId: string;
+ taskId: string;
+ attachmentId: string;
+}): string {
+ return `${taskPath({ listId, taskId })}/attachments/${encodeURIComponent(attachmentId.trim())}`;
+}
+
+function matchFilter({ field, value, matchType }: { field: string; value: string; matchType?: string }): string {
+ const escaped = value.replace(/'/g, "''");
+ switch (matchType) {
+ case 'exact':
+ return `${field} eq '${escaped}'`;
+ case 'startsWith':
+ return `startsWith(${field}, '${escaped}')`;
+ default:
+ return `contains(${field}, '${escaped}')`;
+ }
+}
+
+function toDateTimeTimeZone(value: string | undefined): DateTimeTimeZone | undefined {
+ return value ? { dateTime: value, timeZone: 'UTC' } : undefined;
+}
+
+function toTaskList(list: TodoTaskList) {
+ return {
+ id: list.id ?? null,
+ displayName: list.displayName ?? null,
+ isOwner: list.isOwner ?? null,
+ isShared: list.isShared ?? null,
+ wellknownListName: list.wellknownListName ?? null,
+ };
+}
+
+function toTask(task: TodoTask) {
+ return {
+ id: task.id ?? null,
+ title: task.title ?? null,
+ status: task.status ?? null,
+ importance: task.importance ?? null,
+ body: task.body?.content ?? null,
+ bodyContentType: task.body?.contentType ?? null,
+ categories: task.categories ?? [],
+ dueDateTime: task.dueDateTime?.dateTime ?? null,
+ dueTimeZone: task.dueDateTime?.timeZone ?? null,
+ startDateTime: task.startDateTime?.dateTime ?? null,
+ startTimeZone: task.startDateTime?.timeZone ?? null,
+ reminderDateTime: task.reminderDateTime?.dateTime ?? null,
+ reminderTimeZone: task.reminderDateTime?.timeZone ?? null,
+ isReminderOn: task.isReminderOn ?? null,
+ completedDateTime: task.completedDateTime?.dateTime ?? null,
+ hasAttachments: task.hasAttachments ?? null,
+ recurrence: task.recurrence ?? null,
+ createdDateTime: task.createdDateTime ?? null,
+ lastModifiedDateTime: task.lastModifiedDateTime ?? null,
+ bodyLastModifiedDateTime: task.bodyLastModifiedDateTime ?? null,
+ };
+}
+
+function toChecklistItem(item: ChecklistItem) {
+ return {
+ id: item.id ?? null,
+ displayName: item.displayName ?? null,
+ isChecked: item.isChecked ?? null,
+ checkedDateTime: item.checkedDateTime ?? null,
+ createdDateTime: item.createdDateTime ?? null,
+ };
+}
+
+function toLinkedResource(resource: LinkedResource) {
+ return {
+ id: resource.id ?? null,
+ displayName: resource.displayName ?? null,
+ applicationName: resource.applicationName ?? null,
+ webUrl: resource.webUrl ?? null,
+ externalId: resource.externalId ?? null,
+ };
+}
+
+function toAttachment(attachment: TaskFileAttachment) {
+ return {
+ id: attachment.id ?? null,
+ name: attachment.name ?? null,
+ contentType: attachment.contentType ?? null,
+ size: attachment.size ?? null,
+ lastModifiedDateTime: attachment.lastModifiedDateTime ?? null,
+ };
+}
+
+function toImportance(value: string): Importance {
+ return IMPORTANCE_VALUES.find((v) => v === value) ?? 'normal';
+}
+
+function toStatus(value: string): TaskStatus {
+ return STATUS_VALUES.find((v) => v === value) ?? 'notStarted';
+}
+
+function clampTop(value: number | undefined): number {
+ if (value === undefined || value === null) {
+ return 50;
+ }
+ return Math.min(Math.max(Math.trunc(value), 1), 100);
+}
+
+const IMPORTANCE_VALUES: Importance[] = ['low', 'normal', 'high'];
+const STATUS_VALUES: TaskStatus[] = ['notStarted', 'inProgress', 'completed', 'waitingOnOthers', 'deferred'];
+
+export const todoApi = {
+ listPage,
+ listAll,
+ listPath,
+ taskPath,
+ checklistItemPath,
+ linkedResourcePath,
+ attachmentPath,
+ matchFilter,
+ toDateTimeTimeZone,
+ toImportance,
+ toStatus,
+ toTaskList,
+ toTask,
+ toChecklistItem,
+ toLinkedResource,
+ toAttachment,
+};
+
+export const TASK_STATUS_OPTIONS = [
+ { label: 'Not Started', value: 'notStarted' },
+ { label: 'In Progress', value: 'inProgress' },
+ { label: 'Completed', value: 'completed' },
+ { label: 'Waiting On Others', value: 'waitingOnOthers' },
+ { label: 'Deferred', value: 'deferred' },
+];
+
+export const IMPORTANCE_OPTIONS = [
+ { label: 'Low', value: 'low' },
+ { label: 'Normal', value: 'normal' },
+ { label: 'High', value: 'high' },
+];
+
+export const MATCH_TYPE_OPTIONS = [
+ { label: 'Contains', value: 'contains' },
+ { label: 'Starts With', value: 'startsWith' },
+ { label: 'Exact Match', value: 'exact' },
+];
diff --git a/packages/pieces/community/microsoft-todo/src/lib/common/todo-props.ts b/packages/pieces/community/microsoft-todo/src/lib/common/todo-props.ts
new file mode 100644
index 00000000000..af4721123b5
--- /dev/null
+++ b/packages/pieces/community/microsoft-todo/src/lib/common/todo-props.ts
@@ -0,0 +1,67 @@
+import { Property } from '@activepieces/pieces-framework';
+
+function listId() {
+ return Property.ShortText({
+ displayName: 'Task List ID',
+ description: 'ID of the task list, from List Task Lists or Create Task List.',
+ required: true,
+ });
+}
+
+function taskId() {
+ return Property.ShortText({
+ displayName: 'Task ID',
+ description: 'ID of the task, from List Tasks or Create Task.',
+ required: true,
+ });
+}
+
+function checklistItemId() {
+ return Property.ShortText({
+ displayName: 'Checklist Item ID',
+ description: 'ID of the checklist item, from List Checklist Items or Add Checklist Item.',
+ required: true,
+ });
+}
+
+function linkedResourceId() {
+ return Property.ShortText({
+ displayName: 'Linked Resource ID',
+ description: 'ID of the linked resource, from List Linked Resources or Create Linked Resource.',
+ required: true,
+ });
+}
+
+function attachmentId() {
+ return Property.ShortText({
+ displayName: 'Attachment ID',
+ description: 'ID of the attachment, from List Task Attachments or Upload Task Attachment.',
+ required: true,
+ });
+}
+
+function pageToken() {
+ return Property.ShortText({
+ displayName: 'Page Token',
+ description: 'The nextPageToken returned by the previous call. Leave empty for the first page.',
+ required: false,
+ });
+}
+
+function limit() {
+ return Property.Number({
+ displayName: 'Limit',
+ description: 'Maximum number of results per page (1-100). Defaults to 50.',
+ required: false,
+ });
+}
+
+export const todoProps = {
+ listId,
+ taskId,
+ checklistItemId,
+ linkedResourceId,
+ attachmentId,
+ pageToken,
+ limit,
+};
diff --git a/packages/pieces/community/microsoft-todo/src/lib/output-schemas.ts b/packages/pieces/community/microsoft-todo/src/lib/output-schemas.ts
new file mode 100644
index 00000000000..6ac5324d99a
--- /dev/null
+++ b/packages/pieces/community/microsoft-todo/src/lib/output-schemas.ts
@@ -0,0 +1,283 @@
+import { OutputSchema } from '@activepieces/pieces-framework';
+
+const taskListFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'List ID' },
+ { key: 'displayName', label: 'Name' },
+ { key: 'isOwner', label: 'Owner', format: 'boolean' },
+ { key: 'isShared', label: 'Shared', format: 'boolean' },
+ { key: 'wellknownListName', label: 'Well-Known List Name' },
+];
+
+const taskFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'Task ID' },
+ { key: 'title', label: 'Title' },
+ { key: 'status', label: 'Status' },
+ { key: 'importance', label: 'Importance' },
+ { key: 'body', label: 'Body' },
+ { key: 'bodyContentType', label: 'Body Content Type' },
+ { key: 'categories', label: 'Categories' },
+ { key: 'dueDateTime', label: 'Due Date', format: 'datetime' },
+ { key: 'dueTimeZone', label: 'Due Time Zone' },
+ { key: 'startDateTime', label: 'Start Date', format: 'datetime' },
+ { key: 'startTimeZone', label: 'Start Time Zone' },
+ { key: 'reminderDateTime', label: 'Reminder Date', format: 'datetime' },
+ { key: 'reminderTimeZone', label: 'Reminder Time Zone' },
+ { key: 'isReminderOn', label: 'Reminder On', format: 'boolean' },
+ { key: 'completedDateTime', label: 'Completed At', format: 'datetime' },
+ { key: 'hasAttachments', label: 'Has Attachments', format: 'boolean' },
+ { key: 'recurrence', label: 'Recurrence' },
+ { key: 'createdDateTime', label: 'Created At', format: 'datetime' },
+ { key: 'lastModifiedDateTime', label: 'Last Modified At', format: 'datetime' },
+ { key: 'bodyLastModifiedDateTime', label: 'Body Last Modified At', format: 'datetime' },
+];
+
+const checklistItemFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'Checklist Item ID' },
+ { key: 'displayName', label: 'Name' },
+ { key: 'isChecked', label: 'Checked', format: 'boolean' },
+ { key: 'checkedDateTime', label: 'Checked At', format: 'datetime' },
+ { key: 'createdDateTime', label: 'Created At', format: 'datetime' },
+];
+
+const linkedResourceFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'Linked Resource ID' },
+ { key: 'displayName', label: 'Name' },
+ { key: 'applicationName', label: 'Application Name' },
+ { key: 'webUrl', label: 'Web URL', format: 'url' },
+ { key: 'externalId', label: 'External ID' },
+];
+
+const attachmentFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'Attachment ID' },
+ { key: 'name', label: 'File Name' },
+ { key: 'contentType', label: 'Content Type' },
+ { key: 'size', label: 'Size', format: 'filesize' },
+ { key: 'lastModifiedDateTime', label: 'Last Modified At', format: 'datetime' },
+];
+
+const dateTimeTimeZoneFields: OutputSchema['fields'] = [
+ { key: 'dateTime', label: 'Date', format: 'datetime' },
+ { key: 'timeZone', label: 'Time Zone' },
+];
+
+const graphTaskBaseFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'Task ID' },
+ { key: 'title', label: 'Title' },
+ { key: 'status', label: 'Status' },
+ { key: 'importance', label: 'Importance' },
+ { key: 'isReminderOn', label: 'Reminder On', format: 'boolean' },
+ { key: 'categories', label: 'Categories' },
+ { key: 'hasAttachments', label: 'Has Attachments', format: 'boolean' },
+ { key: 'createdDateTime', label: 'Created At', format: 'datetime' },
+ { key: 'lastModifiedDateTime', label: 'Last Modified At', format: 'datetime' },
+ {
+ key: 'body',
+ label: 'Body',
+ children: [
+ { key: 'content', label: 'Content' },
+ { key: 'contentType', label: 'Content Type' },
+ ],
+ },
+];
+
+const graphTaskDueFields: OutputSchema['fields'] = [
+ ...graphTaskBaseFields,
+ { key: 'dueDateTime', label: 'Due Date', children: dateTimeTimeZoneFields },
+];
+
+export const taskListOutputSchema: OutputSchema = { fields: taskListFields };
+
+export const microsoftTodoListTaskListsOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'lists', label: 'Task Lists', labelKey: 'displayName', listItems: taskListFields },
+ { key: 'count', label: 'Count', format: 'number' },
+ { key: 'nextPageToken', label: 'Next Page Token' },
+ ],
+};
+
+export const microsoftTodoDeleteTaskListOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'success', label: 'Success', format: 'boolean' },
+ { key: 'listId', label: 'List ID' },
+ ],
+};
+
+export const taskOutputSchema: OutputSchema = { fields: taskFields };
+
+export const microsoftTodoListTasksOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'tasks', label: 'Tasks', labelKey: 'title', listItems: taskFields },
+ { key: 'count', label: 'Count', format: 'number' },
+ { key: 'nextPageToken', label: 'Next Page Token' },
+ ],
+};
+
+export const microsoftTodoSearchTasksOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'tasks',
+ label: 'Tasks',
+ labelKey: 'title',
+ listItems: [
+ ...taskFields,
+ { key: 'listId', label: 'List ID' },
+ { key: 'listName', label: 'List Name' },
+ ],
+ },
+ { key: 'count', label: 'Count', format: 'number' },
+ { key: 'truncated', label: 'Truncated', format: 'boolean' },
+ ],
+};
+
+export const microsoftTodoMoveTaskOutputSchema: OutputSchema = {
+ fields: [
+ ...taskFields,
+ { key: 'listId', label: 'List ID' },
+ { key: 'previousListId', label: 'Previous List ID' },
+ { key: 'previousTaskId', label: 'Previous Task ID' },
+ { key: 'checklistItemCount', label: 'Checklist Items Copied', format: 'number' },
+ { key: 'linkedResourceCount', label: 'Linked Resources Copied', format: 'number' },
+ ],
+};
+
+export const microsoftTodoDeleteTaskOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'success', label: 'Success', format: 'boolean' },
+ { key: 'listId', label: 'List ID' },
+ { key: 'taskId', label: 'Task ID' },
+ ],
+};
+
+export const checklistItemOutputSchema: OutputSchema = { fields: checklistItemFields };
+
+export const microsoftTodoListChecklistItemsOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'checklistItems', label: 'Checklist Items', labelKey: 'displayName', listItems: checklistItemFields },
+ { key: 'count', label: 'Count', format: 'number' },
+ ],
+};
+
+export const microsoftTodoDeleteChecklistItemOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'success', label: 'Success', format: 'boolean' },
+ { key: 'listId', label: 'List ID' },
+ { key: 'taskId', label: 'Task ID' },
+ { key: 'checklistItemId', label: 'Checklist Item ID' },
+ ],
+};
+
+export const linkedResourceOutputSchema: OutputSchema = { fields: linkedResourceFields };
+
+export const microsoftTodoListLinkedResourcesOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'linkedResources', label: 'Linked Resources', labelKey: 'displayName', listItems: linkedResourceFields },
+ { key: 'count', label: 'Count', format: 'number' },
+ ],
+};
+
+export const microsoftTodoDeleteLinkedResourceOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'success', label: 'Success', format: 'boolean' },
+ { key: 'listId', label: 'List ID' },
+ { key: 'taskId', label: 'Task ID' },
+ { key: 'linkedResourceId', label: 'Linked Resource ID' },
+ ],
+};
+
+export const attachmentOutputSchema: OutputSchema = { fields: attachmentFields };
+
+export const microsoftTodoListTaskAttachmentsOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'attachments', label: 'Attachments', labelKey: 'name', listItems: attachmentFields },
+ { key: 'count', label: 'Count', format: 'number' },
+ ],
+};
+
+export const microsoftTodoDownloadTaskAttachmentOutputSchema: OutputSchema = {
+ fields: [...attachmentFields, { key: 'file', label: 'File' }],
+};
+
+export const microsoftTodoDeleteTaskAttachmentOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'success', label: 'Success', format: 'boolean' },
+ { key: 'listId', label: 'List ID' },
+ { key: 'taskId', label: 'Task ID' },
+ { key: 'attachmentId', label: 'Attachment ID' },
+ ],
+};
+
+export const microsoftTodoGetCurrentUserOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'id', label: 'User ID' },
+ { key: 'displayName', label: 'Display Name' },
+ { key: 'givenName', label: 'First Name' },
+ { key: 'surname', label: 'Last Name' },
+ { key: 'mail', label: 'Email', format: 'email' },
+ { key: 'userPrincipalName', label: 'User Principal Name', format: 'email' },
+ { key: 'jobTitle', label: 'Job Title' },
+ { key: 'preferredLanguage', label: 'Preferred Language' },
+ ],
+};
+
+export const listTaskListsOutputSchema: OutputSchema = {
+ fields: [{ key: 'lists', label: 'Task Lists', value: '', listItems: taskListFields }],
+ itemLabel: '{displayName}',
+};
+
+export const findTaskListByNameOutputSchema: OutputSchema = {
+ fields: [{ key: 'lists', label: 'Matching Task Lists', value: '', listItems: taskListFields }],
+ itemLabel: '{displayName}',
+};
+
+export const createTaskOutputSchema: OutputSchema = { fields: graphTaskDueFields };
+
+export const completeTaskOutputSchema: OutputSchema = {
+ fields: [
+ ...graphTaskDueFields,
+ { key: 'completedDateTime', label: 'Completed At', children: dateTimeTimeZoneFields },
+ ],
+};
+
+export const listTasksOutputSchema: OutputSchema = {
+ fields: [{ key: 'tasks', label: 'Tasks', value: '', listItems: graphTaskDueFields }],
+ itemLabel: '{title}',
+};
+
+export const findTaskByTitleOutputSchema: OutputSchema = {
+ fields: [{ key: 'tasks', label: 'Matching Tasks', value: '', listItems: graphTaskDueFields }],
+ itemLabel: '{title}',
+};
+
+export const deleteTaskOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'success', label: 'Success', format: 'boolean' },
+ { key: 'message', label: 'Message' },
+ ],
+};
+
+export const addAttachmentOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'id', label: 'Attachment ID' },
+ { key: 'name', label: 'File Name' },
+ { key: 'contentType', label: 'Content Type' },
+ { key: 'size', label: 'Size', format: 'filesize' },
+ { key: 'lastModifiedDateTime', label: 'Last Modified At', format: 'datetime' },
+ ],
+};
+
+export const newOrUpdatedTaskOutputSchema: OutputSchema = {
+ fields: [
+ ...graphTaskDueFields,
+ { key: 'startDateTime', label: 'Start Date', children: dateTimeTimeZoneFields },
+ { key: 'reminderDateTime', label: 'Reminder Date', children: dateTimeTimeZoneFields },
+ ],
+};
+
+export const taskCompletedOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'title', label: 'Title' },
+ { key: 'status', label: 'Status' },
+ { key: 'importance', label: 'Importance' },
+ { key: 'isReminderOn', label: 'Reminder On', format: 'boolean' },
+ ],
+};
diff --git a/packages/pieces/community/microsoft-todo/src/lib/triggers/new-list-created.ts b/packages/pieces/community/microsoft-todo/src/lib/triggers/new-list-created.ts
index f75b9fe152d..e86331dd00d 100644
--- a/packages/pieces/community/microsoft-todo/src/lib/triggers/new-list-created.ts
+++ b/packages/pieces/community/microsoft-todo/src/lib/triggers/new-list-created.ts
@@ -3,6 +3,7 @@ import { DedupeStrategy, Polling, pollingHelper } from '@activepieces/pieces-com
import { microsoftToDoAuth } from '../auth';
import { TodoTaskList } from '@microsoft/microsoft-graph-types';
import { createTodoClient } from '../common';
+import { taskListOutputSchema } from '../output-schemas';
const polling: Polling<AppConnectionValueForAuthProperty<typeof microsoftToDoAuth>, Record<string, never>> = {
strategy: DedupeStrategy.LAST_ITEM,
@@ -22,6 +23,7 @@ const polling: Polling<AppConnectionValueForAuthProperty<typeof microsoftToDoAut
export const newListCreatedTrigger = createTrigger({
auth: microsoftToDoAuth,
name: 'new_list_created',
+ outputSchema: taskListOutputSchema,
classification: 'READ',
displayName: 'New List',
description: 'Triggers when a new task list is created.',
diff --git a/packages/pieces/community/microsoft-todo/src/lib/triggers/new-task-created.ts b/packages/pieces/community/microsoft-todo/src/lib/triggers/new-task-created.ts
index 9561e7db430..eb1b54d4ff6 100644
--- a/packages/pieces/community/microsoft-todo/src/lib/triggers/new-task-created.ts
+++ b/packages/pieces/community/microsoft-todo/src/lib/triggers/new-task-created.ts
@@ -6,6 +6,7 @@ import { microsoftToDoAuth } from '../auth';
import { PageCollection } from '@microsoft/microsoft-graph-client';
import dayjs from 'dayjs';
import { TodoTask } from '@microsoft/microsoft-graph-types';
+import { newOrUpdatedTaskOutputSchema } from '../output-schemas';
const polling: Polling<AppConnectionValueForAuthProperty<typeof microsoftToDoAuth>, { task_list_id: string }> = {
strategy: DedupeStrategy.TIMEBASED,
@@ -51,6 +52,7 @@ const polling: Polling<AppConnectionValueForAuthProperty<typeof microsoftToDoAut
export const newTaskCreatedTrigger = createTrigger({
name: 'new_task_created',
+ outputSchema: newOrUpdatedTaskOutputSchema,
classification: 'READ',
displayName: 'New Task',
description: 'Triggers when a new task is created.',
diff --git a/packages/pieces/community/microsoft-todo/src/lib/triggers/task-completed.ts b/packages/pieces/community/microsoft-todo/src/lib/triggers/task-completed.ts
index 11c7856a5e9..d9ac3a68bb8 100644
--- a/packages/pieces/community/microsoft-todo/src/lib/triggers/task-completed.ts
+++ b/packages/pieces/community/microsoft-todo/src/lib/triggers/task-completed.ts
@@ -1,6 +1,7 @@
-import { OAuth2PropertyValue, Property, TriggerStrategy, createTrigger } from '@activepieces/pieces-framework';
+import { OAuth2PropertyValue, Property, TriggerStrategy, WebhookHandshakeStrategy, createTrigger } from '@activepieces/pieces-framework';
import { getTaskListsDropdown, createTodoClient } from '../common';
import { microsoftToDoAuth } from '../auth';
+import { taskCompletedOutputSchema } from '../output-schemas';
import dayjs from 'dayjs';
import { TodoTask } from '@microsoft/microsoft-graph-types';
@@ -39,7 +40,19 @@ export const taskCompletedTrigger = createTrigger({
},
}),
},
+ outputSchema: taskCompletedOutputSchema,
type: TriggerStrategy.WEBHOOK,
+ handshakeConfiguration: {
+ strategy: WebhookHandshakeStrategy.QUERY_PRESENT,
+ paramName: 'validationToken',
+ },
+ async onHandshake(context) {
+ return {
+ status: 200,
+ body: context.payload.queryParams['validationToken'],
+ headers: { 'Content-Type': 'text/plain' },
+ };
+ },
sampleData: {
'@odata.etag': 'W/"vVwdQvxCiE6779iYhchMrAAGgwrltg=="',
importance: 'normal',
diff --git a/packages/pieces/community/microsoft-todo/src/lib/triggers/task-updated.ts b/packages/pieces/community/microsoft-todo/src/lib/triggers/task-updated.ts
index ba0e34b3aa9..5e35ce64732 100644
--- a/packages/pieces/community/microsoft-todo/src/lib/triggers/task-updated.ts
+++ b/packages/pieces/community/microsoft-todo/src/lib/triggers/task-updated.ts
@@ -6,6 +6,7 @@ import { microsoftToDoAuth } from '../auth';
import { PageCollection } from '@microsoft/microsoft-graph-client';
import dayjs from 'dayjs';
import { TodoTask } from '@microsoft/microsoft-graph-types';
+import { newOrUpdatedTaskOutputSchema } from '../output-schemas';
const polling: Polling<AppConnectionValueForAuthProperty<typeof microsoftToDoAuth>, { task_list_id: string }> = {
strategy: DedupeStrategy.TIMEBASED,
@@ -51,6 +52,7 @@ const polling: Polling<AppConnectionValueForAuthProperty<typeof microsoftToDoAut
export const newOrUpdatedTaskTrigger = createTrigger({
name: 'new_or_updated_task',
+ outputSchema: newOrUpdatedTaskOutputSchema,
classification: 'READ',
displayName: 'New or Updated Task',
description: 'Triggers when a new task is created or an existing task is updated.',