Forum Discussion
How do I create a roster plan?
Here my notes from investigating and testing this earlier. Hope it helps.
Microsoft has changed this by using Roster Containers:
- https://m365admin.handsontek.net/planners-new-roster-containers/
- This is managed via Graph APIs
- Roster: is the "security container" that holds the members and plans
- First create a Roster then create a Plan adding it to the Roster
- Creator of the Roster is automatically member.
- Additional Members to the Roster can be added via the Planner Web-UI
Planner Roster APIs:
https://learn.microsoft.com/en-us/graph/api/planner-post-rosters?view=graph-rest-beta&tabs=http
Create Roster
POST https://graph.microsoft.com/beta/planner/rosters
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.plannerRoster"
}
Create Plan in Roster
You need to follow the documentation to create a Roster, then you can create a Plan by calling a POST to beta/planner/plans with a request body like this:
{
"container": {
"@odata.type": "microsoft.graph.plannerPlanContainer",
"containerId": "{RosterID}",
"type": "roster"
},
"title": "My Roster"
}
Testing
Use the Graph Explorer | Try Microsoft Graph APIs - Microsoft Graph to test
Utalising Power Platform
Power Automate can be used to build a solution to create rosters (while waiting for MS to create UI options in planner)
- Create app registration (needed for the Flow to access graph
- Create a List in SharePoint for requesting new Rosters (Plan Name, and owner of Plan)
- Create a Power Automate Flow when new list item is created, to create a roster (using APIs above) and create a plan in the Roster and adding the owner as member (use this as example using the above APIs)
Check if roster is enabled via Powershell
- It is by default
- https://learn.microsoft.com/en-us/office365/planner/prerequisites-for-powershell
- Get-PlannerConfiguration
JohnMoore33 Thanks for the info this was very helpful! I used your info to convert this into a set of PowerShell commands for anyone to try:
#Import Modules if needed
Import-Module Microsoft.Graph.Beta.Planner
#Connect to Graph with your credentials
Connect-MgGraph -Scopes "Tasks.ReadWrite"
#Capture Name of Planner
$Title = Read-Host -Prompt 'What is the Roster Plan name?'
$params = @{
"@odata.type" = "#microsoft.graph.plannerRoster"
}
#Save to variable to capture containerID for later
$ContainerID = New-MgBetaPlannerRoster -BodyParameter $params
$params = @{
container = @{
"@odata.type" = "microsoft.graph.plannerPlanContainer"
#Use saved ContainerID
"containerId" = $ContainerID.Id
"type" = "roster"
}
title = $Title
}
New-MgBetaPlannerPlan -BodyParameter $params
- Anton DorfmannDec 12, 2023Copper ContributorPiyush_Mistry should'nt this new roster plan show up in planner somewhere? I´ve created some and added also my user as owner and member, but no luck. Do ou have an idea?
- Piyush_MistryDec 12, 2023Copper Contributor
Anton Dorfmann - Do you mean after you create both the Planner Roster, and subsequent plan in PowerShell you don't see it in the Planner web UI?
You should be able to find it by going to M365 >> Planner >> Hub (Menu) >> at the bottom switch from 'Recent' >> 'All'.
Don't try finding it on the left menu by selecting 'Show more' as it only shows some of the most recent plans you've used and since these are new plans it will likely not show if you have too many.
- Anton DorfmannDec 12, 2023Copper ContributorHi Piyush_Mistry, ok, my fail was that i did not create asubsequent plan inside the Roster. Do i need to create the plan with this command New-MgBetaPlannerPlan ?
thank you