创建 educationClassCreate educationClass

命名空间:microsoft.graphNamespace: microsoft.graph

创建新课程。Create a new class. 此操作还会创建通用组。This will also create a universal group. 当您使用此 API 创建一个类时,它会将特殊的属性添加到组中,这将在使用组创建团队时,将在 Microsoft 团队中添加工作分配和特殊处理等功能。When you use this API to create a class, it will add special properties to the group, which will add features such as assignments and special handling within Microsoft Teams when teams are created using the group. 请注意,此 API 仅创建通用组,不创建团队。Please note that this API only creates the universal group and does not create a team. Microsoft 团队为教师提供了用户界面,以使用此 API 创建的组为自己的类创建团队。Microsoft Teams provides a user interface for teachers to create teams for their own classes using the groups created by this API.

权限Permissions

要调用此 API,需要以下权限之一。要了解详细信息,包括如何选择权限的信息,请参阅权限One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.

权限类型Permission type 权限(从最低特权到最高特权)Permissions (from least to most privileged)
委派(工作或学校帐户)Delegated (work or school account) 不支持。Not supported.
委派(个人 Microsoft 帐户)Delegated (personal Microsoft account) 不支持。Not supported.
应用程序Application EduRoster.ReadWrite.AllEduRoster.ReadWrite.All

HTTP 请求HTTP request

POST /education/classes

请求标头Request headers

标头Header Value
AuthorizationAuthorization Bearer {token}。必需。Bearer {token}. Required.
Content-TypeContent-Type application/jsonapplication/json

请求正文Request body

在请求正文中,提供 educationClass 对象的 JSON 表示形式。In the request body, supply a JSON representation of an educationClass object.

响应Response

如果成功,此方法会在响应正文中返回 201 Created 响应代码和 educationClass 对象。If successful, this method returns a 201 Created response code and an educationClass object in the response body.

示例Example

请求Request

下面展示了示例请求。The following is an example of the request.

POST https://graph.microsoft.com/v1.0/education/classes
Content-type: application/json
Content-length: 224

{
  "description": "Health Level 1",
  "classCode": "Health 501",
  "displayName": "Health 1",
  "externalId": "11019",
  "externalName": "Health Level 1",
  "externalSource": "sis",
  "mailNickname": "fineartschool.net"
}
响应Response

下面展示了示例响应。The following is an example of the response.

注意: 为了提高可读性,可能缩短了此处显示的响应对象。所有属性都将通过实际调用返回。Note: The response object shown here might be shortened for readability. All the properties will be returned from an actual call.

HTTP/1.1 201 Created
Content-type: application/json
Content-length: 224

{
    "id": "11019",
    "description": "Health Level 1",
    "classCode": "Health 501",
    "createdBy": {
      "user": {
        "displayName": "Susana Rocha",
        "id": "14012",
      }
    },
    "displayName": "Health 1",
    "externalId": "11019",
    "externalName": "Health Level 1",
    "externalSource": "sis",
    "mailNickname": "fineartschool.net"
}