Remove-MgUserTodoListTask

What is Remove-MgUserTodoListTask?

Remove-MgUserTodoListTask is a Microsoft Graph PowerShell cmdlet used to delete a specific Microsoft To Do task from a user’s task list by providing the UserId, TodoTaskListId, and TodoTaskId.

🚀 Community Edition Released!

Try the M365Corner Microsoft 365 Reporting Tool — your DIY pack with 20+ out-of-the-box M365 reports for Users, Groups, and Teams.

Why Use Remove-MgUserTodoListTask?

Administrators and automation engineers use this cmdlet to clean up unwanted or outdated tasks programmatically, especially when managing tasks in bulk across users. It is useful for automating task removal during offboarding, project closures, or routine housekeeping in Microsoft To Do.


Prerequisites

Before running this cmdlet, ensure you have:

  • Microsoft Graph PowerShell module installed
  • Required permissions to manage Microsoft To Do tasks
  • A valid UserId, TodoTaskListId, and TodoTaskId

Example connection command (typical for To Do operations):

Connect-MgGraph -Scopes "Tasks.ReadWrite"

How to use Remove-MgUserTodoListTask?

Use the cmdlet by passing the user identifier, the task list ID, and the task ID you want to delete.

Syntax:

Remove-MgUserTodoListTask -UserId <String> -TodoTaskListId <String> -TodoTaskId <String> 

Remove-MgUserTodoListTask Examples

  • Example 1: Remove a Single Task from a User’s To Do List
  • This example removes a single task from a specific task list of a user. The UserId, TodoTaskListId, and TodoTaskId are the required parameters.

    Remove-MgUserTodoListTask -UserId "john.doe@contoso.com" -TodoTaskListId "AAMkAGVmMWZmNjczLTFiZGUtNDMzNi05N2RkLTgwZDA1MjlkZDY0ZgBGAAAAAAC" -TodoTaskId "AQMkAGVmMWZmNjczLTFiZGUtNDMzNi05N2RkLTgwZDA1MjlkZDY0ZwAAA="
  • Example 2: Remove Multiple Tasks in a Single Command
  • This script loops through an array of task IDs and removes them one by one.

    $taskIds = @("AQMkAGVmMWZmNjczLTFiZGUtNDMzNi05N2RkLTgwZDA1MjlkZDY0ZwAAA=", "AQMkAGVmMWZmNjczLTFiZGUtNDMzNi05N2RkLTgwZDA1MjlkZDY0ZwAAB=")
    $todoListId = "AAMkAGVmMWZmNjczLTFiZGUtNDMzNi05N2RkLTgwZDA1MjlkZDY0ZgBGAAAAAAC"
    $userId = "john.doe@contoso.com"
    
    foreach ($taskId in $taskIds) {
        Remove-MgUserTodoListTask -UserId $userId -TodoTaskListId $todoListId -TodoTaskId $taskId
    }
                                                
  • Example 3: Bulk Task Removal via CSV File
  • This example shows how to remove tasks in bulk using a CSV file. The CSV file should contain a list of task IDs along with the user ID and task list ID.

    $csvFile = "C:\TasksToRemove.csv"
    $tasks = Import-Csv $csvFile
    
    foreach ($task in $tasks) {
        Remove-MgUserTodoListTask -UserId $task.UserId -TodoTaskListId $task.TodoTaskListId -TodoTaskId $task.TodoTaskId
    }
                                                

    CSV File Structure

    UserId,TodoTaskListId,TodoTaskId
        john.doe@contoso.com,AAMkAGVmMWZmNjczLTFiZGUtNDMzNi05N2RkLTgwZDA1MjlkZDY0ZgBGAAAAAAC,AQMkAGVmMWZmNjczLTFiZGUtNDMzNi05N2RkLTgwZDA1MjlkZDY0ZwAAA=
        jane.doe@contoso.com,AAMkAGVmMWZmNjczLTFiZGUtNDMzNi05N2RkLTgwZDA1MjlkZDY0ZgBGAAAAAAC,AQMkAGVmMWZmNjczLTFiZGUtNDMzNi05N2RkLTgwZDA1MjlkZDY0ZwAAB=
                                                

Summary

Key Point Details
Cmdlet Name Remove-MgUserTodoListTask
Purpose Deletes a specific Microsoft To Do task from a user’s task list
Required Scope Tasks.ReadWrite
Primary Parameters UserId, TodoTaskListId, TodoTaskId
Automation Benefit Helps admins remove tasks in bulk using scripts or CSV
Use Case Offboarding cleanup, removing obsolete tasks, task list maintenance

Did You Know? Managing Microsoft 365 applications is even easier with automation. Try our Graph PowerShell scripts to automate tasks like generating reports, cleaning up inactive Teams, or assigning licenses efficiently.

Ready to get the most out of Microsoft 365 tools? Explore our free Microsoft 365 administration tools to simplify your administrative tasks and boost productivity.

© Created and Maintained by LEARNIT WELL SOLUTIONS. All Rights Reserved.