Introduction
Microsoft Planner is a powerful tool for managing collaborative tasks in the Microsoft 365 ecosystem. However, tracking incomplete tasks can become a challenge for system administrators and advanced users. This article explains in detail how to automate the generation and sending of a weekly email detailing incomplete tasks in Planner.
Good to Know
To implement this solution, you will need to use the Microsoft Graph PowerShell SDK, as well as configure an Azure Automation account with the necessary permissions.
Analysis of Incomplete Tasks
The objective of this process is to centralize information on incomplete tasks for each team member. Here are the fundamental steps:
- Identify a security group containing the targeted members.
- Find all plans associated with Microsoft 365 Groups to which each member belongs.
- Retrieve open (non-completed) tasks in these plans.
- Send a personalized email to each user with a summary of open tasks, included as a direct link to each task.
Using the Microsoft Graph API with PowerShell
In this context, we use the Planner module from Microsoft Graph PowerShell SDK. Here are the key cmdlets:
Get-MgGroupPlannerPlan: Get plans associated with a Microsoft 365 group.Get-MgPlannerPlanTask: Retrieve tasks from a specific plan.Get-MgPlannerPlanBucket: Get the subdivisions (buckets) of a plan.
Example Script to Retrieve Incomplete Tasks
1[array]$Tasks = Get-MgPlannerPlanTask -PlannerPlanId $Plan.Id -All -PageSize 500 -Property Id, Title, CompletedDateTime, StartDateTime, DueDateTime, BucketId, Assignments -ErrorAction Stop2 3$IncompleteTasks = $Tasks | Where-Object { $null -eq $_.CompletedDateTime }Attention
The Graph API for Planner has major limitations, such as the inability to filter directly on properties like percentComplete. This filtering must be performed client-side.
Azure Automation Configuration
Once the script is tested in interactive mode, it must be integrated into an Azure Automation runbook. Here are the main steps:
Create an Azure Automation Account
Log in to the Azure portal and create an automation account to host the script.
Assign Necessary Permissions
Ensure that the automation account has permissions to access Microsoft Graph. This includes permissions for Planner and Microsoft 365 Groups.
Import Required Modules
Add the necessary modules to your automation account, including the Microsoft Graph PowerShell SDK module.
Test and Schedule the Runbook
Execute the runbook interactively to validate its operation, then schedule its execution. For example, configure it to run every Saturday at 7 AM.
Automated Report Delivery via Email
The script generates a summary of incomplete tasks in email form and includes:
- Task title.
- Start date and due date.
- Hyperlink to the task in the Planner application.
Code Excerpt: Sending an Email
1Send-MailMessage -To $UserEmail -Subject "Weekly Report: Incomplete Tasks" -Body $EmailBody -SmtpServer "smtp.office365.com" -Credential $SMTPAuthLimitations of the Graph API for Planner
Although the Graph API is a robust interface, certain limitations remain:
- Lack of search or sorting of tasks within plans.
- No method to list plans where a user has assigned tasks. This operation requires navigation through Microsoft 365 groups.
Tip
Use client-side methods to structure and filter data after retrieval. This ensures greater flexibility in processing results.
Conclusion
Automating the management of incomplete tasks in Planner is a process that combines PowerShell and the capabilities of Azure Automation. Despite the challenges posed by API limitations, this approach improves team productivity while ensuring structured tracking.
As a system administrator or cloud engineer, you can adapt this script to other business scenarios by leveraging the capabilities of Microsoft Graph PowerShell SDK and Azure Automation.
Important
Make sure to secure your authentication parameters and comply with your organization's security policies when configuring automation.



