Manual Teams class creation — source example
Inspect the captured manual education-class creation example. The source explicitly says a missing class should be checked in Edumate rather than created by running this example.
Source-derived reference
These notes were recovered from OneNote. Configuration, permissions and operating results have not been freshly verified. Confirm the applicable authority and environment before acting.
NOTE: YOU SHOULD NEVER NEED TO RUN THIS. If a team in missing or a teacher can't find it, then you should check with Edumate.
Reference:
- Create educationClass - Microsoft Graph v1.0 | Microsoft Learn
- New-MgBetaEducationClass (Microsoft.Graph.Beta.Education) | Microsoft Learn
Import-Module Microsoft.Graph.Beta.Education
##ADDING NEW GROUP
#Group MailNickname: 2026-TheLakes-12HMS-1
#Group Name: Year 12 Health and Movement Science 1 (2026)
#Group Description: 12HMS 1 | TheLakes
#GroupOwnersCount: 1
#GroupMembersCount: 4
$params = @{
"classCode" = "12HMS 1"
"externalSourceDetail" = "Powershell CCMX.MgGraphEducation"
"externalId" = "2026-TheLakes-12HMS-1"
"mailNickname" = "2026-TheLakes-12HMS-1"
"externalName" = "2026-TheLakes-12HMS-1"
"displayName" = "Year 12 Health and Movement Science 1 (2026)"
"description" = "12HMS 1 | TheLakes"
}
$newgroup = New-MgBetaEducationClass -BodyParameter $params
$educationClassId = $newgroup.Id
#USING THE $educationClassId FROM THE ABOVE IS USED WHEN ASSIGNING AN OWNER TO THE TEAM
#In this scenario $educationClassId is equal to "164de2bc-1510-434f-8b8f-eef324e38e54".
#The Id of the new owner is "84732a7b-824e-4276-9f97-03b13a7f893a".
##ADDING OWNER
#Group MailNickname: 2026-TheLakes-12HMS-1
#Owner Name: [example owner; personal name omitted]
#HELPER TO SEE EXISTING OWNERS IN M365:
#$(Invoke-MgGraphRequest -Method GET -Uri #"https://graph.microsoft.com/v1.0/education/classes/164de2bc-1510-434f-8b8f-eef324e38e54/teachers").Value.Value)
#ADDS AN OWNER TO THE GROUP
$ownerId = "84732a7b-824e-4276-9f97-03b13a7f893a"
$ApiParams = @{
"@odata.id" = "https://graph.microsoft.com/v1.0/education/users/84732a7b-824e-4276-9f97-03b13a7f893a"
}
Invoke-MgGraphRequest -Method POST -Uri "https://graph.microsoft.com/v1.0/education/classes/164de2bc-1510-434f-8b8f-eef324e38e54/teachers/$ref" -Body $ApiParams