New-MgUserTodoListTask is a Microsoft Graph PowerShell cmdlet used to create tasks in a user’s Microsoft To Do task list. It allows administrators and automation scripts to add tasks with properties such as title, due date, and priority directly into a specific To Do list.
Try the M365Corner Microsoft 365 Reporting Tool — your DIY pack with 20+ out-of-the-box M365 reports for Users, Groups, and Teams.
This cmdlet is particularly useful for automation scenarios, including:
It removes the need for manual task creation and ensures tasks are created consistently across users.
Before using this cmdlet, ensure you are connected to Microsoft Graph with the required permissions:
Connect-MgGraph -Scopes "Tasks.ReadWrite"
Basic syntax:
New-MgUserTodoListTask -UserId <String> -TodoTaskListId <String> -BodyParameter <PSObject>
You must specify the target user, the To Do task list ID, and provide task details using the -BodyParameter hashtable.
Create a task with specific details such as a title, due date, and priority.
$TaskDetails = @{
title = "Prepare Quarterly Report"
dueDateTime = @{ dateTime = "2024-11-15T17:00:00"; timeZone = "UTC" }
importance = "high"
}
New-MgUserTodoListTask -UserId "john.doe@contoso.com" -TodoTaskListId "A1B2C3D4" -BodyParameter $TaskDetails
Create multiple tasks for a user by iterating through a list of task details.
$Tasks = @(
@{ title = "Complete Budget Analysis"; dueDateTime = @{ dateTime = "2024-11-18T17:00:00"; timeZone = "UTC" }; importance = "normal" },
@{ title = "Team Meeting Preparation"; dueDateTime = @{ dateTime = "2024-11-20T10:00:00"; timeZone = "UTC" }; importance = "low" }
)
foreach ($Task in $Tasks) {
New-MgUserTodoListTask -UserId "john.doe@contoso.com" -TodoTaskListId "A1B2C3D4" -BodyParameter $Task
}
Use a CSV file to create tasks for multiple users.
$Tasks = Import-Csv "Tasks.csv"
foreach ($Task in $Tasks) {
$TaskDetails = @{
title = $Task.Title
dueDateTime = @{ dateTime = $Task.DueDateTime; timeZone = "UTC" }
importance = $Task.Importance
}
New-MgUserTodoListTask -UserId $Task.UserId -TodoTaskListId $Task.TodoTaskListId -BodyParameter $TaskDetails
}
| Key Point | Details |
| Cmdlet Name | New-MgUserTodoListTask |
| Purpose | Creates tasks in a Microsoft To Do list |
| Required Scope | Tasks.ReadWrite |
| Target Resource | User To Do task list |
| Automation Benefit | Enables bulk and automated task creation |
| Common Use Case | Task assignment, reminders, project tracking |
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.
© Your Site Name. All Rights Reserved. Design by HTML Codex