列出用户的分配
命名空间:microsoft.graph
返回分配给所有类的 educationUser 的 educationAssignment的列表。 只有具有应用程序权限的教师、学生和应用程序才能执行此操作。
此方法允许调用方在单个调用中查找属于学生或教师的所有作业,而无需从每个班级请求作业。 分配列表包含从类命名空间中获取分配的详细信息所需的内容。 对所有其他操作使用为 赋值 定义的方法。
注意:、
instructions
assignedDateTime
、assignTo
resourcesFolderUrl
和webUrl
属性将始终显示 null。
此 API 可用于以下国家级云部署。
全局服务 | 美国政府 L4 | 美国政府 L5 (DOD) | 由世纪互联运营的中国 |
---|---|---|---|
✅ | ❌ | ❌ | ❌ |
权限
为此 API 选择标记为最低特权的权限。 只有在应用需要它时,才使用更高的特权权限。 有关委派权限和应用程序权限的详细信息,请参阅权限类型。 要了解有关这些权限的详细信息,请参阅 权限参考。
权限类型 | 最低特权权限 | 更高特权权限 |
---|---|---|
委派(工作或学校帐户) | EduAssignments.ReadBasic | EduAssignments.Read、EduAssignments.ReadWrite、EduAssignments.ReadWriteBasic |
委派(个人 Microsoft 帐户) | 不支持。 | 不支持。 |
应用程序 | EduAssignments.ReadBasic.All | EduAssignments.Read.All、EduAssignments.ReadWrite.All、EduAssignments.ReadWriteBasic.All |
/me
调用终结点需要已登录用户,因此需要委派的权限。 使用 /me
终结点时,不支持应用程序权限。
终结点 /users/{user-id}
适用于委派权限和应用程序权限。
HTTP 请求
GET /education/me/assignments
GET /education/users/{user-id}/assignments
可选的查询参数
此方法支持 $top
、 $filter
、 $orderby
和 $select
OData 查询参数来帮助自定义响应。 若要了解一般信息,请参阅 OData 查询参数。
查询参数支持$filter
所有属性。
可以与 educationAssignment 资源的以下属性一$orderby
起使用:assignDateTime、assignedDateTime、closeDateTime、createdDateTime、displayName、dueDateTime、lastModifiedDateTime 和 status。
请求标头
标头 | 值 |
---|---|
Authorization | 持有者 {token}。 必填。 详细了解 身份验证和授权。 |
请求正文
请勿提供此方法的请求正文。
响应
如果成功,此方法在响应正文中返回响应 200 OK
代码和 educationAssignment 对象的集合。
示例
示例 1:获取已登录用户的分配
请求
以下示例显示了一个请求。
GET https://graph.microsoft.com/v1.0/education/me/assignments
响应
以下示例显示了相应的响应。
注意:为了提高可读性,可能缩短了此处显示的响应对象。
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#education/me/assignments",
"value": [
{
"classId": "72a7baec-c3e9-4213-a850-f62de0adad5f",
"displayName": "Expand options 3.1",
"closeDateTime": "2021-11-19T07:59:00Z",
"dueDateTime": "2021-11-19T07:59:00Z",
"assignDateTime": null,
"assignedDateTime": null,
"allowLateSubmissions": false,
"resourcesFolderUrl": null,
"createdDateTime": "2021-11-10T23:56:21.1575202Z",
"lastModifiedDateTime": "2021-11-17T16:00:30.0523446Z",
"allowStudentsToAddResourcesToSubmission": false,
"status": "published",
"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%223b870c07-21fe-47fb-8562-cdd6f2c281d6%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": "none",
"addedStudentAction": "none",
"id": "3b870c07-21fe-47fb-8562-cdd6f2c281d6",
"instructions": null,
"grading": null,
"assignTo": null,
"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
}
}
}
]
}
示例 2:获取用户的分配
请求
以下示例显示了一个请求。
GET https://graph.microsoft.com/v1.0/education/users/f3a5344e-dbde-48b0-be24-b5b62a243836/assignments
响应
如果用户尝试查询与其自己的用户不同的用户,此方法将 403 Forbidden
返回响应代码。
以下示例显示了相应的响应。
注意:为了提高可读性,可能缩短了此处显示的响应对象。
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#education/users('f3a5344e-dbde-48b0-be24-b5b62a243836')/assignments",
"value": [
{
"classId": "72a7baec-c3e9-4213-a850-f62de0adad5f",
"displayName": "Expand options 3.1",
"closeDateTime": "2021-11-19T07:59:00Z",
"dueDateTime": "2021-11-19T07:59:00Z",
"assignDateTime": null,
"assignedDateTime": null,
"allowLateSubmissions": false,
"resourcesFolderUrl": null,
"createdDateTime": "2021-11-10T23:56:21.1575202Z",
"lastModifiedDateTime": "2021-11-17T16:00:30.0523446Z",
"allowStudentsToAddResourcesToSubmission": false,
"status": "published",
"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%223b870c07-21fe-47fb-8562-cdd6f2c281d6%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": "none",
"addedStudentAction": "none",
"id": "3b870c07-21fe-47fb-8562-cdd6f2c281d6",
"instructions": null,
"grading": null,
"assignTo": null,
"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
}
}
}
]
}
示例 3:使用展开提交获取用户分配
请求
以下示例显示了一个请求。
GET https://graph.microsoft.com/v1.0/education/users/80cefd93-8d88-40e2-b5d3-67898383e226/assignments?expand=submissions
响应
以下示例显示了相应的响应。
注意: 如果用户具有学生角色,它将扩展提交,并且对于教师角色,它将为 null。
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#education/users('80cefd93-8d88-40e2-b5d3-67898383e226')/assignments(submissions())",
"value": [
{
"classId": "72a7baec-c3e9-4213-a850-f62de0adad5f",
"displayName": "Reading test 09.03 #4",
"closeDateTime": null,
"dueDateTime": "2021-09-07T00:00:00Z",
"assignDateTime": null,
"assignedDateTime": null,
"allowLateSubmissions": true,
"resourcesFolderUrl": null,
"createdDateTime": "2021-09-13T19:18:35.2587894Z",
"lastModifiedDateTime": "2021-09-13T19:19:56.6381405Z",
"allowStudentsToAddResourcesToSubmission": false,
"status": "assigned",
"notificationChannelUrl": null,
"webUrl": null,
"addToCalendarAction": "none",
"addedStudentAction": "none",
"id": "1618dfb0-3ff2-4edf-8d5c-b8f81df00e80",
"instructions": null,
"assignTo": null,
"grading": {
"@odata.type": "#microsoft.graph.educationAssignmentPointsGradeType",
"maxPoints": 50
},
"createdBy": {
"application": null,
"device": null,
"user": {
"id": "f3a5344e-dbde-48b0-be24-b5b62a243836",
"displayName": null
}
},
"lastModifiedBy": {
"application": null,
"device": null,
"user": {
"id": "AAAAAAAA-0123-4567-89AB-1B4BB48C3119",
"displayName": null
}
},
"submissions": [
{
"status": "working",
"submittedDateTime": null,
"unsubmittedDateTime": null,
"returnedDateTime": null,
"reassignedDateTime": null,
"resourcesFolderUrl": null,
"id": "da443246-384d-673b-32db-bdba9d7f2b51",
"recipient": {
"@odata.type": "#microsoft.graph.educationSubmissionIndividualRecipient",
"userId": "80cefd93-8d88-40e2-b5d3-67898383e226"
},
"submittedBy": {
"application": null,
"device": null,
"user": {
"id": "80cefd93-8d88-40e2-b5d3-67898383e226",
"displayName": null
}
},
"unsubmittedBy": {
"application": null,
"device": null,
"user": {
"id": null,
"displayName": null
}
},
"returnedBy": {
"application": null,
"device": null,
"user": {
"id": null,
"displayName": null
}
},
"reassignedBy": {
"application": null,
"device": null,
"user": {
"id": null,
"displayName": null
}
}
}
]
}
]
}
示例 4:使用 $filter
获取用户分配
请求
以下示例显示了一个请求。
GET https://graph.microsoft.com/v1.0/education/me/assignments?$filter=dueDateTime eq 2050-05-18T17:00:00Z
响应
以下示例显示了相应的响应。
注意:为了提高可读性,可能缩短了此处显示的响应对象。
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#education/me/assignments",
"@odata.nextLink": "https://graph.microsoft.com/v1.0/education/me/assignments?$filter=dueDateTime+eq+2050-05-18T17%3a00%3a00Z&$skiptoken=MyZRVkZCUVVGQlFVRk9RVUZCUVVGQlFVRkJRWGxCUVVGQmVFNDJOV0pqWTJ0RVJXMVFUVU5NUTJodVUxYzVkejA5",
"value": [
{
"classId": "2003c52e-807a-4186-9b49-60c573095461",
"displayName": "2022-04-14T05_08_50_854Z",
"closeDateTime": "2050-05-26T17:00:00Z",
"dueDateTime": "2050-05-18T17:00:00Z",
"assignDateTime": null,
"assignedDateTime": null,
"allowLateSubmissions": true,
"resourcesFolderUrl": null,
"feedbackResourcesFolderUrl": null,
"createdDateTime": "2022-04-13T05:09:21.009Z",
"lastModifiedDateTime": "2022-10-19T23:02:21.3868802Z",
"allowStudentsToAddResourcesToSubmission": false,
"status": "assigned",
"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%222003c52e-807a-4186-9b49-60c573095461%5C%22,%5C%22displayName%5C%22%3Anull,%5C%22assignmentIds%5C%22%3A%5B%5C%222be08d97-b140-4eec-8cbd-88238d571060%5C%22%5D,%5C%22submissionId%5C%22%3Anull%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": "none",
"addedStudentAction": "none",
"id": "2be08d97-b140-4eec-8cbd-88238d571060",
"instructions": null,
"assignTo": null,
"grading": {
"@odata.type": "#microsoft.graph.educationAssignmentPointsGradeType",
"maxPoints": 100
},
"createdBy": {
"application": null,
"device": null,
"user": {
"id": "fffafb29-e8bc-4de3-8106-be76ed2ad499",
"displayName": null
}
},
"lastModifiedBy": {
"application": null,
"device": null,
"user": {
"id": "AAAAAAAA-0123-4567-89AB-1B4BB48C3119",
"displayName": null
}
}
}
]
}
示例 5:使用 $orderby
获取用户分配
请求
以下示例显示了一个请求。
GET https://graph.microsoft.com/v1.0/education/me/assignments?$orderby=createdDateTime
响应
以下示例显示了相应的响应。
注意:为了提高可读性,可能缩短了此处显示的响应对象。
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#education/me/assignments",
"@odata.nextLink": "https://graph.microsoft.com/v1.0/education/me/assignments?$orderby=createdDateTime&$skiptoken=MyZRVkZCUVVGQlFVRlVkMUZCUVVGQlFVRkJRWGxCUVVGQmNFRkhaMEY1ZFhOelJXRm1TRmRrWTBoT1MwVjVRVDA5",
"@microsoft.graph.tips": "Use $select to choose only the properties your app needs, as this can lead to performance improvements. For example: GET education/me/assignments?$select=addedStudentAction,addToCalendarAction",
"value": [
{
"classId": "b009a655-584c-4cb7-80dd-2cf04ec863d2",
"displayName": "2023-08-30T05:24:32.267Z2578",
"closeDateTime": null,
"dueDateTime": "2023-09-29T05:24:32.267Z",
"assignDateTime": null,
"assignedDateTime": "2023-08-30T05:24:40.846Z",
"allowLateSubmissions": true,
"resourcesFolderUrl": null,
"feedbackResourcesFolderUrl": null,
"createdDateTime": "2023-08-30T05:24:32.492Z",
"lastModifiedDateTime": "2023-08-30T05:24:40.905Z",
"allowStudentsToAddResourcesToSubmission": false,
"status": "assigned",
"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%22b009a655-584c-4cb7-80dd-2cf04ec863d2%5C%22,%5C%22assignmentIds%5C%22%3A%5B%5C%22e9d561aa-a6b2-4b53-8dcb-999f202d6bef%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,%5C%22appId%5C%22%3A%5C%22de8bc8b5-d9f9-48b1-a8ad-b748da725064%5C%22%7D%22,%22channelId%22%3Anull%7D",
"addToCalendarAction": "none",
"addedStudentAction": "none",
"id": "e9d561aa-a6b2-4b53-8dcb-999f202d6bef",
"instructions": null,
"assignTo": null,
"grading": {
"@odata.type": "#microsoft.graph.educationAssignmentPointsGradeType",
"maxPoints": 100
},
"createdBy": {
"application": null,
"device": null,
"user": {
"id": "fffafb29-e8bc-4de3-8106-be76ed2ad499",
"displayName": null
}
},
"lastModifiedBy": {
"application": null,
"device": null,
"user": {
"id": "AAAAAAAA-0123-4567-89AB-1B4BB48C3119",
"displayName": null
}
}
}
]
}