更新 educationassignment

命名空间:microsoft.graph

重要

Microsoft Graph /beta 版本下的 API 可能会发生更改。 不支持在生产应用程序中使用这些 API。 若要确定 API 是否在 v1.0 中可用,请使用 版本 选择器。

更新 educationAssignment 对象。

只有班上的老师才能做到这一点。 不能使用 PATCH 请求更改 作业的状态。 使用 发布 操作更改 作业 状态。

API 可用性

此 API 可用于以下国家级云部署。

全局服务 美国政府 L4 美国政府 L5 (DOD) 由世纪互联运营的中国
✅ ❌ ❌ ❌

权限

为此 API 选择标记为最低特权的权限。 只有在应用需要它时,才使用更高的特权权限。 有关委派权限和应用程序权限的详细信息,请参阅权限类型。 要了解有关这些权限的详细信息,请参阅 权限参考。

权限类型 最低特权权限 更高特权权限
委派(工作或学校帐户) EduAssignments.ReadWriteBasic EduAssignments.ReadWrite
委派(个人 Microsoft 帐户) 不支持。 不支持。
应用程序 EduAssignments.ReadWriteBasic.All EduAssignments.ReadWrite.All

HTTP 请求

PATCH /education/classes/{class-id}/assignments/{assignment-id}

请求标头

标头 值
Authorization 持有者 {token}。 必填。 详细了解 身份验证和授权。
Content-Type application/json

请求正文

在请求正文中,提供应更新的相关字段的值。 请求正文中未包含的现有属性将保留其以前的值或根据其他属性值的更改重新计算。 为了获得最佳性能,请勿加入尚未更改的现有值。

属性 类型 说明
addedStudentAction String 控制发布作业后添加的学生的行为。
addToCalendarAction educationAddToCalendarOptions 用于控制作业行为的可选字段,用于在发布作业时将作业添加到学生和教师的日历。 可能的值包括 none、studentsAndPublisher、studentsAndTeamOwners、studentsOnly、unknownFutureValue。 默认值为 none。 作业处于状态时 published 无法修改。
allowLateSubmissions 布尔值 是否可以在截止日期之后提交提交。
allowStudentsToAddResourcesToSubmission 布尔值 学生是否可以向提交添加资源。 指示提交上的唯一项目是否来自作业资源列表。
assignDateTime DateTimeOffset 作业应发布给学生的日期。 作业发布时无法编辑。
assignTo educationAssignmentRecipient 收到作业的学生。
closeDateTime DateTimeOffset 作业因提交而关闭的日期。 这是一个可选字段,如果分配不允许LateSubmissions 或 closeDateTime 与 dueDateTime 相同,则该字段可以为 null,但如果指定,它必须大于或等于 dueDateTime。
displayName String 分配的名称。
dueDateTime DateTimeOffset 作业截止日期。
评分 educationAssignmentGradeType 作业评分方式。
说明 itemBody 与作业一起给予学生的指示。
languageTag String 指定作业的 UI 通知显示语言。 如果未提供 languageTag ,则默认语言为 en-US。 可选。
notificationChannelUrl String 用于发布作业发布通知的频道。 发布作业后不允许更新频道 URL,并且仅当 assignTo 值为 educationAssignmentClassRecipient 时才允许更新。

响应

如果成功,此方法将在响应正文中返回 200 OK 响应代码和更新的 educationAssignment 对象。

示例

请求

以下示例显示了一个请求。

PATCH https://graph.microsoft.com/beta/education/classes/72a7baec-c3e9-4213-a850-f62de0adad5f/assignments/4679bc1b-90c5-45af-ae1a-d5357672ed39
Content-type: application/json

{
    "displayName": "Reading and review test 09.03 #5",
    "instructions": {
        "contentType": "text",
        "content": "Read chapter 5 and write your review"
    },
    "dueDateTime": "2021-09-10T00:00:00Z",
    "addedStudentAction": "none",
    "languageTag": "pt-BR",
    "addToCalendarAction": "studentsAndPublisher"
}

响应

以下示例显示了相应的响应。

注意:为了提高可读性,可能缩短了此处显示的响应对象。

HTTP/1.1 200 OK
Content-type: application/json

{
    "@odata.context": "https://graph.microsoft.com/beta/$metadata#education/classes('72a7baec-c3e9-4213-a850-f62de0adad5f')/assignments/$entity",
    "classId": "72a7baec-c3e9-4213-a850-f62de0adad5f",
    "displayName": "Reading and review test 09.03 #5",
    "closeDateTime": null,
    "dueDateTime": "2021-09-10T00:00:00Z",
    "assignDateTime": null,
    "assignedDateTime": null,
    "allowLateSubmissions": true,
    "resourcesFolderUrl": null,
    "createdDateTime": "2021-09-03T23:57:14.6088791Z",
    "lastModifiedDateTime": "2021-09-04T15:01:35.3361649Z",
    "allowStudentsToAddResourcesToSubmission": true,
    "status": "draft",
    "notificationChannelUrl": null,
    "webUrl": "https://teams.microsoft.com/l/entity/66aeee93-507d-479a-a3ef-8f494af43945/classroom?context=%7B%22subEntityId%22%3A%22%7B%5C%22version%5C%22%3A%5C%221.0%5C%22,%5C%22config%5C%22%3A%7B%5C%22classes%5C%22%3A%5B%7B%5C%22id%5C%22%3A%5C%2272a7baec-c3e9-4213-a850-f62de0adad5f%5C%22,%5C%22displayName%5C%22%3Anull,%5C%22assignmentIds%5C%22%3A%5B%5C%224679bc1b-90c5-45af-ae1a-d5357672ed39%5C%22%5D%7D%5D%7D,%5C%22action%5C%22%3A%5C%22navigate%5C%22,%5C%22view%5C%22%3A%5C%22assignment-viewer%5C%22%7D%22,%22channelId%22%3Anull%7D",
    "addToCalendarAction": "studentsAndPublisher",
    "addedStudentAction": "none",
    "languageTag": "pt-BR",
    "id": "4679bc1b-90c5-45af-ae1a-d5357672ed39",
    "instructions": {
        "content": "Read chapter 5 and write your review",
        "contentType": "text"
    },
    "grading": {
        "@odata.type": "#microsoft.graph.educationAssignmentPointsGradeType",
        "maxPoints": 50
    },
    "assignTo": {
        "@odata.type": "#microsoft.graph.educationAssignmentClassRecipient"
    },
    "createdBy": {
        "application": null,
        "device": null,
        "user": {
            "id": "f3a5344e-dbde-48b0-be24-b5b62a243836",
            "displayName": null
        }
    },
    "lastModifiedBy": {
        "application": null,
        "device": null,
        "user": {
            "id": "f3a5344e-dbde-48b0-be24-b5b62a243836",
            "displayName": null
        }
    }
}