Create Microsoft ToDo Task with PowerShell and Microsoft GRAPH API

Now it is time to create some Microsoft ToDo Tasks with PowerShell and MS Graph API.

To learn more from Microsoft GRAPH API, see my Blog Series:
Part 1 – Authentication and Azure App – Use Microsoft Graph API with PowerShell – Part 1 » TechGuy
Part 2 – Oauth2.0 – Use Microsoft Graph API with PowerShell – Part 2 » TechGuy
Part 3 – First Powershell Script to get a Teams List and Walkthrough – Use Microsoft Graph API with PowerShell – Part 3 » TechGuy
Part 4 – Some Examples – Use Microsoft Graph API with PowerShell – Part 4 » TechGuy

API Reference and Permissions

Here is the official Doc: Create todoTask – Microsoft Graph v1.0 | Microsoft Docs

Depending on that, we need the Following Permissions for our Azure App

  • Delagte: Tasks.ReadWrite

The Script

$clientID = "your APP ID"
$User = "your User"
$PW = "your Password"
$resource = ""

$MicrosoftToDoListName = "My Tasks"
$title = "A New Task"
$importance = "normal" #Options: high, normal, low
$Body = "Thats my Body Text"


#Connect to GRAPH API
$tokenBody = @{  
    Grant_Type = "password"  
    Scope      = ""  
    Client_Id  = $clientId  
    username   = $User
    password   = $pw
    resource   = $resource

$tokenResponse = Invoke-RestMethod "" -Method Post -ContentType "application/x-www-form-urlencoded" -Body $tokenBody -ErrorAction STOP
$headers = @{
    "Authorization" = "Bearer $($tokenResponse.access_token)"
    "Content-type"  = "application/json"

#Get ID of List
$URLGetToDoLists = "`$filter=displayName eq '$($MicrosoftToDoListName)'"
$Return = Invoke-RestMethod -Method GET -Headers $headers -Uri $URLGetToDoLists
$ListID = $

#Create a Task
$URLCreateTask = "$ListID/tasks"
$JsonBody = @"

$Return = Invoke-RestMethod -Method POST -Headers $headers -Uri $URLCreateTask -Body $JsonBody

The Result

Now you see a Task in Microsoft ToDo create with PowerShell and MS GRAPH API

GitHub Repo

Here you can find lots of other MS GRAPH API examples on my GitHub Repo: Seidlm/Microsoft-Graph-API-Examples (

Michael Seidl aka Techguy
au2mate everything

Leave a Comment

Your email address will not be published. Required fields are marked *


%d bloggers like this: