Using Get-MgGroupPlannerPlan in Graph PowerShell

The Get-MgGroupPlannerPlan cmdlet in the Microsoft Graph PowerShell module is used to retrieve plans from Microsoft Planner associated with a specific group. This cmdlet is valuable for IT administrators and project managers who need to automate the retrieval of Planner plans for reporting or management purposes.


Syntax

Get-MgGroupPlannerPlan -GroupId <String> [-ExpandProperty <String[]>] [-Property <String[]>]
  • GroupId: Specifies the ID of the group whose Planner plans are to be retrieved.
  • ExpandProperty: Expands related entities inline.
  • Property: Selects specific properties to be returned.

Usage Examples

Retrieve All Planner Plans for a Group

This command retrieves all Planner plans associated with the specified group.

$groupId = "d7b14b9a-6d4b-4a1c-bd74-67c6c4aaf2ed"
Get-MgGroupPlannerPlan -GroupId $groupId

Retrieve Specific Properties of Planner Plans

This command retrieves the specified properties of all Planner plans associated with the specified group.

$groupId = "d7b14b9a-6d4b-4a1c-bd74-67c6c4aaf2ed"
Get-MgGroupPlannerPlan -GroupId $groupId -Property "id", "title", "owner"

Filter Plans by Title

This command retrieves all Planner plans for a group and filters them to return only those with titles containing "Project".

$groupId = "d7b14b9a-6d4b-4a1c-bd74-67c6c4aaf2ed"
$plans = Get-MgGroupPlannerPlan -GroupId $groupId
$filteredPlans = $plans | Where-Object { $_.title -like "*Project*" }
$filteredPlans

Cmdlet Tips

  • Permissions: Ensure you have the necessary permissions to access Planner plans. Typically, this requires Group.ReadWrite.All permissions.
  • Property Selection: Use the -Property parameter to limit the properties returned and improve performance.
  • Related Entities: To retrieve related entities such as buckets or tasks, use the appropriate cmdlets (e.g., Get-MgPlannerBucket, Get-MgPlannerTask) with the plan ID.

Use Cases

  • Project Management: Retrieve all Planner plans for a team to monitor project progress and ensure tasks are on track.
  • Reporting: Automate the generation of reports that include details about Planner plans.
  • Integration: Integrate Planner plan retrieval into other automation scripts for a seamless workflow.

Frequently Asked Questions

  • Can I retrieve all Planner plans across the organization?
  • Yes, you can loop through all Microsoft 365 Groups using Get-MgGroup and then call Get-MgGroupPlannerPlan for each group. This is useful for generating a tenant-wide Planner inventory report.

  • Why does Get-MgGroupPlannerPlan return an empty result?
  • This usually occurs if the group doesn’t have any associated Planner plans or if the authenticated account lacks the required Group.Read.All or Group.ReadWrite.All permissions.

  • How can I retrieve plan details such as title or owner directly?
  • Use the -ExpandProperty parameter with Get-MgGroupPlannerPlan to include nested details like the plan title, owner, and creation date in a single command.

  • Can I export Planner plan details to a CSV file?
  • Absolutely. You can pipe the results to Select-Object to choose the properties you need, then export them using Export-Csv for easy reporting

Possible Errors & Solutions

Error Cause Solution
Insufficient Permissions The account running the cmdlet does not have the required permissions to access Planner plans. Ensure the account has the Group.ReadWrite.All Graph API permission. Connect-MgGraph -Scopes "Group.ReadWrite.All"
Invalid GroupId The provided GroupId is incorrect or does not exist. Verify the GroupId and ensure it is correct.
API Throttling Too many requests are being made to the Microsoft Graph API in a short period. Implement retry logic with exponential backoff to handle throttling.
# Example of retry logic
$retryCount = 0
$maxRetries = 5
$groupId = "d7b14b9a-6d4b-4a1c-bd74-67c6c4aaf2ed"
do {
     try {
           $plans = Get-MgGroupPlannerPlan -GroupId $groupId
           break
     } catch {
           $retryCount++
           Start-Sleep -Seconds ([math]::Pow(2, $retryCount))
     }
 } while ($retryCount -lt $maxRetries)
                                        
 if (-not $plans) {
            Write-Error "Failed to retrieve Planner plans after $maxRetries retries"
 }

✅ Retrieve Planner Plans for Specific Microsoft 365 Groups

If your tenant contains numerous groups, you can narrow results by specifying a group ID when running Get-MgGroupPlannerPlan.

This ensures you retrieve only the plans associated with that particular group, improving script performance and clarity in large environments.
💡 Use -ExpandProperty to Access Plan Details Instantly

The -ExpandProperty parameter allows you to access embedded Planner plan details, such as the title, owner, or creation date, without needing multiple queries.

This saves time when building dashboards or exporting Planner data across several groups.

Conclusion

The Get-MgGroupPlannerPlan cmdlet is a powerful tool for retrieving Microsoft Planner plans associated with a specific group using the Microsoft Graph PowerShell module. By understanding its syntax, parameters, and usage, you can effectively manage and automate tasks related to Planner plans. Remember to handle possible errors appropriately to ensure smooth execution of your scripts.


Additional Resources

Graph PowerShell Get-MgGroupPlannerPlan Cmdlet Doc
Microsoft Graph PowerShell Module Documentation
Microsoft Graph API Documentation

Related Articles:

Using Get-MgDirectoryRole in Graph PowerShell
Using Get-MgUserLicenseDetail in Graph PowerShell
Using Find-GraphMgCommand in Graph PowerShell
Connect to Microsoft 365 Using PowerShell
How to Create Bulk Users in Office 365 Using Graph PowerShell?
Create Microsoft 365 Group Using Microsoft Graph PowerShell
Block Microsoft 365 User Using Microsoft Graph PowerShell
Assign Microsoft 365 License Using Graph PowerShell
Microsoft 365 User Management Using Graph PowerShell
Checking Group Membership in Microsoft 365
Bulk Assign Microsoft 365 License
Find Inactive Users in Microsoft 365
Using Powershell Graph Search Query
Using Powershell Graph Filter Query
Using Where-Object In Graph PowerShell
Using Expand Property In Graph PowerShell
Using Select Object In Graph PowerShell
Using -Contains Operator In Graph PowerShell
Add User to Multiple Microsoft 365 Groups Using Graph PowerShell
Get Microsoft 365 User Location Using Graph PowerShell
Import Microsoft 365 Groups from CSV File Using Graph PowerShell
Microsoft 365 Group User Import Using Graph PowerShell

© m365corner.com. All Rights Reserved. Design by HTML Codex