更新 educationassignment

命名空间:microsoft.graph

更新 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、unknownFutureValue、studentsOnly。 使用 Prefer: include - unknown -enum-members 请求标头获取此 可进化枚举中的以下成员: studentsOnly. 可选。
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。 发布作业后,频道 URL 无法更改。

响应

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

示例

请求

下面是请求的示例。

PATCH https://graph.microsoft.com/v1.0/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"
}

响应

以下是响应示例。

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

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

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$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",
    "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
        }
    }
}