Microsoft Graph /beta 版本下的 API 可能会发生更改。 不支持在生产应用程序中使用这些 API。 若要确定 API 是否在 v1.0 中可用,请使用 版本 选择器。
创建新课程。 此操作还会创建通用组。 使用此 API 创建类时,它将向组添加特殊属性,当使用组创建团队时,将在 Microsoft Teams 中添加工作分配和特殊处理等功能。 请注意,此 API 仅创建通用组,不创建团队。 Microsoft Teams 提供了一个用户界面,供教师使用此 API 创建的组为自己的课堂创建团队。
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new EducationClass
{
Description = "Health Level 1",
ClassCode = "Health 501",
DisplayName = "Health 1",
ExternalId = "11019",
ExternalName = "Health Level 1",
ExternalSource = EducationExternalSource.Sis,
MailNickname = "fineartschool.net",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Education.Classes.PostAsync(requestBody);
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
EducationClass educationClass = new EducationClass();
educationClass.setDescription("Health Level 1");
educationClass.setClassCode("Health 501");
educationClass.setDisplayName("Health 1");
educationClass.setExternalId("11019");
educationClass.setExternalName("Health Level 1");
educationClass.setExternalSource(EducationExternalSource.Sis);
educationClass.setMailNickname("fineartschool.net");
EducationClass result = graphClient.education().classes().post(educationClass);
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.education_class import EducationClass
from msgraph_beta.generated.models.education_external_source import EducationExternalSource
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = EducationClass(
description = "Health Level 1",
class_code = "Health 501",
display_name = "Health 1",
external_id = "11019",
external_name = "Health Level 1",
external_source = EducationExternalSource.Sis,
mail_nickname = "fineartschool.net",
)
result = await graph_client.education.classes.post(request_body)