microsoft-graph-apimicrosoft365microsoft-todo

Event when a user is completing a todo or other task


I would like to use tasks instead of email for part of our system. I know how to create a task with MS Graph but what I am looking for is a way to run an azure function whenever a user is completing the task I sent.

Is there something I can listen to in Graph or Azure and fire the azure function with parameters from the task (user, job etc...) Any idea?


Solution

  • Microsoft Graph API allows you to subscribe to changes to all tasks in a specific task list for the following endpoint

    /me/todo/lists/{todoTaskListId}/tasks
    

    You can't get notification for tasks of other users.

    But I'm not sure if the received notification contains details whether the task was completed etc.

    The second option is to use a delta function call for todoTask to track changes in the todoTask resource

    GET /me/todo/lists/{id}/tasks/delta
    GET /users/{id|userPrincipalName}/todo/lists/{todoTaskListId}/tasks/delta
    

    But you need to call delta periodically to get set of changes.

    Resources:

    Change notification

    Create subscription

    TODO task delta