创建 educationModuleResource

命名空间:microsoft.graph

在模块中创建资源。 只有教师才能执行此操作。

可以创建以下类型的模块资源:

每个资源都有一个 @odata.type 属性,用于指示正在创建哪种类型的资源。

重要

若要上传模块资源,需要首先为要上传文件的 educationModule设置 resources 文件夹。

API 可用性

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

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

权限

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

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

HTTP 请求

POST /education/classes/{class-id}/modules/{module-id}/resources

请求标头

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

请求正文

在请求正文中,提供以下资源类型之一的 JSON 表示形式:

注意: 不能使用此操作创建 educationExternalResource。

响应

如果成功,此方法将在响应正文中返回 201 Created 响应代码和 educationModuleResource 对象。

示例

示例 1:创建 educationLinkResource

请求

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

POST https://graph.microsoft.com/v1.0/education/classes/37d99af7-cfc5-4e3b-8566-f7d40e4a2070/modules/74b318fa-e882-4dad-8e1c-dab091b12fe7/resources
Content-type: application/json

{
    "resource": {
         "@odata.type": "#microsoft.graph.educationLinkResource",
         "displayName":"Bing site",
         "link": "https://www.bing.com"
     }
}

响应

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

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

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

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#education/classes('37d99af7-cfc5-4e3b-8566-f7d40e4a2070')/modules('24eda3bf-32e5-4c70-a14d-831e606a2e4f')/resources/$entity",
    "id": "b8dc1d8e-7606-467f-a1e4-c9f1a864d208",
    "resource": {
        "@odata.type": "#microsoft.graph.educationLinkResource",
        "displayName": "Bing site",
        "createdDateTime": "2024-01-17T17:51:45.1612454Z",
        "lastModifiedDateTime": "2024-01-17T17:51:45.1612463Z",
        "link": "https://www.bing.com",
        "createdBy": {
            "application": null,
            "device": null,
            "user": {
                "id": "fadaae59-b18c-44d1-993f-fe8a281bd69c",
                "displayName": null
            }
        },
        "lastModifiedBy": {
            "application": null,
            "device": null,
            "user": {
                "id": "fadaae59-b18c-44d1-993f-fe8a281bd69c",
                "displayName": null
            }
        }
    }
}

示例 2:创建 educationWordResource

请求

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

POST https://graph.microsoft.com/v1.0/education/classes/37d99af7-cfc5-4e3b-8566-f7d40e4a2070/modules/97acf4f0-d62f-4b98-8827-6ac805fb6949/resources
Content-type: application/json

{
    "resource": {
        "@odata.type": "#microsoft.graph.educationWordResource",
        "displayName": "Word_file.docx",
        "file": {
            "odataid": "https://graph.microsoft.com/v1.0/drives/b!-Ik2sRPLDEWy_bR8l75jfeDcpXQcRKVOmcml10NQLQ1F2UVvTgEnTKi0GO59dbCL/items/01VANVJQ3XYXSBRKMQM5GISQGPVO6BNO27"
        }
    }
}

响应

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

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

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

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#education/classes('37d99af7-cfc5-4e3b-8566-f7d40e4a2070')/modules('97acf4f0-d62f-4b98-8827-6ac805fb6949')/resources/$entity",
    "id": "2d8a475d-918e-4992-b8fe-97ab613c1c49",
    "resource": {
        "@odata.type": "#microsoft.graph.educationWordResource",
        "displayName": "Word_file.docx",
        "createdDateTime": "2024-01-18T17:05:34.3789404Z",
        "lastModifiedDateTime": "2024-01-18T17:05:34.378942Z",
        "fileUrl": "https://graph.microsoft.com/v1.0/drives/b!-Ik2sRPLDEWy_bR8l75jfeDcpXQcRKVOmcml10NQLQ1F2UVvTgEnTKi0GO59dbCL/items/01VANVJQ3XYXSBRKMQM5GISQGPVO6BNO27",
        "createdBy": {
            "application": null,
            "device": null,
            "user": {
                "id": "fadaae59-b18c-44d1-993f-fe8a281bd69c",
                "displayName": null
            }
        },
        "lastModifiedBy": {
            "application": null,
            "device": null,
            "user": {
                "id": "fadaae59-b18c-44d1-993f-fe8a281bd69c",
                "displayName": null
            }
        }
    }
}

示例 3:创建 educationFileResource

请求

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

POST https://graph.microsoft.com/v1.0/education/classes/37d99af7-cfc5-4e3b-8566-f7d40e4a2070/modules/1babf0b0-c885-4f9d-b008-5b0de0cb835d/resources
Content-type: application/json

{
    "resource": {
        "@odata.type": "#microsoft.graph.educationFileResource",
        "displayName": "csv_file.csv",
        "file": {
            "odataid": "https://graph.microsoft.com/v1.0/drives/b!-Ik2sRPLDEWy_bR8l75jfeDcpXQcRKVOmcml10NQLQ1F2UVvTgEnTKi0GO59dbCL/items/01VANVJQ7A2QVVORGJNVBIC4LLM3XQ6UTS"
        }
    }
}

响应

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

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

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

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#education/classes('37d99af7-cfc5-4e3b-8566-f7d40e4a2070')/modules('1babf0b0-c885-4f9d-b008-5b0de0cb835d')/resources/$entity",
    "id": "a6f82f08-3819-435b-b5ac-e286dfe14f9f",
    "resource": {
        "@odata.type": "#microsoft.graph.educationFileResource",
        "displayName": "csv_file.csv",
        "createdDateTime": "2024-01-18T18:02:05.3312223Z",
        "lastModifiedDateTime": "2024-01-18T18:02:05.3312242Z",
        "fileUrl": "https://graph.microsoft.com/v1.0/drives/b!-Ik2sRPLDEWy_bR8l75jfeDcpXQcRKVOmcml10NQLQ1F2UVvTgEnTKi0GO59dbCL/items/01VANVJQ7A2QVVORGJNVBIC4LLM3XQ6UTS",
        "createdBy": {
            "application": null,
            "device": null,
            "user": {
                "id": "fadaae59-b18c-44d1-993f-fe8a281bd69c",
                "displayName": null
            }
        },
        "lastModifiedBy": {
            "application": null,
            "device": null,
            "user": {
                "id": "fadaae59-b18c-44d1-993f-fe8a281bd69c",
                "displayName": null
            }
        }
    }
}

示例 4:创建教育版 ExcelResource

请求

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

POST https://graph.microsoft.com/v1.0/education/classes/37d99af7-cfc5-4e3b-8566-f7d40e4a2070/modules/6a8242df-f2b6-4fdb-9b80-66b847ef8e75/resources
Content-type: application/json

{
    "resource": {
        "@odata.type": "#microsoft.graph.educationExcelResource",
        "displayName": "test_excel_file.xlsx",
        "file": {
            "odataid": "https://graph.microsoft.com/v1.0/drives/b!-Ik2sRPLDEWy_bR8l75jfeDcpXQcRKVOmcml10NQLQ1F2UVvTgEnTKi0GO59dbCL/items/01VANVJQ5DL55LC4M35VEZWBZFJCX5V4QO"
        }
    }
}

响应

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

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

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

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#education/classes('37d99af7-cfc5-4e3b-8566-f7d40e4a2070')/modules('6a8242df-f2b6-4fdb-9b80-66b847ef8e75')/resources/$entity",
    "id": "eaac58ad-a085-4696-82b4-2a5669da4ef0",
    "resource": {
        "@odata.type": "#microsoft.graph.educationExcelResource",
        "displayName": "test_excel_file.xlsx",
        "createdDateTime": "2024-01-18T17:11:21.3773789Z",
        "lastModifiedDateTime": "2024-01-18T17:11:21.3773812Z",
        "fileUrl": "https://graph.microsoft.com/v1.0/drives/b!-Ik2sRPLDEWy_bR8l75jfeDcpXQcRKVOmcml10NQLQ1F2UVvTgEnTKi0GO59dbCL/items/01VANVJQ5DL55LC4M35VEZWBZFJCX5V4QO",
        "createdBy": {
            "application": null,
            "device": null,
            "user": {
                "id": "fadaae59-b18c-44d1-993f-fe8a281bd69c",
                "displayName": null
            }
        },
        "lastModifiedBy": {
            "application": null,
            "device": null,
            "user": {
                "id": "fadaae59-b18c-44d1-993f-fe8a281bd69c",
                "displayName": null
            }
        }
    }
}

示例 5:创建教育版PowerPointResource

请求

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

POST https://graph.microsoft.com/v1.0/education/classes/37d99af7-cfc5-4e3b-8566-f7d40e4a2070/modules/c75c2706-f352-47b4-a11e-f1292305c1d1/resources
Content-type: application/json

{
    "resource": {
        "@odata.type": "#microsoft.graph.educationPowerPointResource",
        "displayName": "ppt_file.pptx",
        "fileUrl": "https://graph.microsoft.com/v1.0/drives/b!-Ik2sRPLDEWy_bR8l75jfeDcpXQcRKVOmcml10NQLQ1F2UVvTgEnTKi0GO59dbCL/items/01VANVJQ2GE3EYXUX6NJEI6UWOKBM74MHA"
    }
}

响应

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

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

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

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#education/classes('37d99af7-cfc5-4e3b-8566-f7d40e4a2070')/modules('c75c2706-f352-47b4-a11e-f1292305c1d1')/resources/$entity",
    "id": "2596ad63-56f4-4a05-bf3e-8918dca4aaa4",
    "resource": {
        "@odata.type": "#microsoft.graph.educationPowerPointResource",
        "displayName": "ppt_file.pptx",
        "createdDateTime": "2024-01-18T17:15:38.6453797Z",
        "lastModifiedDateTime": "2024-01-18T17:15:38.6453821Z",
        "fileUrl": "https://graph.microsoft.com/v1.0/drives/b!-Ik2sRPLDEWy_bR8l75jfeDcpXQcRKVOmcml10NQLQ1F2UVvTgEnTKi0GO59dbCL/items/01VANVJQ2GE3EYXUX6NJEI6UWOKBM74MHA",
        "createdBy": {
            "application": null,
            "device": null,
            "user": {
                "id": "fadaae59-b18c-44d1-993f-fe8a281bd69c",
                "displayName": null
            }
        },
        "lastModifiedBy": {
            "application": null,
            "device": null,
            "user": {
                "id": "fadaae59-b18c-44d1-993f-fe8a281bd69c",
                "displayName": null
            }
        }
    }
}

示例 6:创建 educationMediaResource

请求

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

POST https://graph.microsoft.com/v1.0/education/classes/37d99af7-cfc5-4e3b-8566-f7d40e4a2070/modules/74b318fa-e882-4dad-8e1c-dab091b12fe7/resources
Content-type: application/json

{
    "resource": {
        "@odata.type": "#microsoft.graph.educationMediaResource",
        "displayName": "ModulePicture.PNG",
        "fileUrl": "https://graph.microsoft.com/v1.0/drives/b!-Ik2sRPLDEWy_bR8l75jfeDcpXQcRKVOmcml10NQLQ1F2UVvTgEnTKi0GO59dbCL/items/01VANVJQ56XC3M4V7F5JEK3NLECZH4HWGP"
    }
}

响应

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

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

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

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#education/classes('37d99af7-cfc5-4e3b-8566-f7d40e4a2070')/modules('0655c191-0252-4077-b446-8882e8817831')/resources/$entity",
    "id": "ebe34956-9beb-460a-be13-eae70ac0fe29",
    "resource": {
        "@odata.type": "#microsoft.graph.educationMediaResource",
        "displayName": "ModulePicture.PNG",
        "createdDateTime": "2024-01-18T17:19:38.0361989Z",
        "lastModifiedDateTime": "2024-01-18T17:19:38.0361999Z",
        "fileUrl": "https://graph.microsoft.com/v1.0/drives/b!-Ik2sRPLDEWy_bR8l75jfeDcpXQcRKVOmcml10NQLQ1F2UVvTgEnTKi0GO59dbCL/items/01VANVJQ56XC3M4V7F5JEK3NLECZH4HWGP",
        "createdBy": {
            "application": null,
            "device": null,
            "user": {
                "id": "fadaae59-b18c-44d1-993f-fe8a281bd69c",
                "displayName": null
            }
        },
        "lastModifiedBy": {
            "application": null,
            "device": null,
            "user": {
                "id": "fadaae59-b18c-44d1-993f-fe8a281bd69c",
                "displayName": null
            }
        }
    }
}

示例 7:创建 educationChannelResource

请求

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

POST https://graph.microsoft.com/v1.0/education/classes/37d99af7-cfc5-4e3b-8566-f7d40e4a2070/modules/fe180ab6-4070-40e7-9e9c-eda234fe126a/resources
Content-type: application/json

{
    "resource": {
        "@odata.type": "#microsoft.graph.educationChannelResource",
        "url": "https://graph.microsoft.com/v1.0/teams/37d99af7-cfc5-4e3b-8566-f7d40e4a2070/channels/19:4gSkXJRlsCMnZvBzAcyXGdsGtcQV0AJWtfvQp_a6Fi81@thread.tacv2",
        "displayName": "General"
    }
}

响应

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

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

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

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#education/classes('37d99af7-cfc5-4e3b-8566-f7d40e4a2070')/modules('fe180ab6-4070-40e7-9e9c-eda234fe126a')/resources/$entity",
    "id": "00fb5e7d-6d2e-4d7d-9deb-cd9d8be4af41",
    "resource": {
        "@odata.type": "#microsoft.graph.educationChannelResource",
        "displayName": "General",
        "createdDateTime": "2024-01-18T17:52:10.3067568Z",
        "lastModifiedDateTime": "2024-01-18T17:52:10.3067579Z",
        "url": "https://graph.microsoft.com/v1.0/teams/37d99af7-cfc5-4e3b-8566-f7d40e4a2070/channels/19:4gSkXJRlsCMnZvBzAcyXGdsGtcQV0AJWtfvQp_a6Fi81@thread.tacv2",
        "createdBy": {
            "application": null,
            "device": null,
            "user": {
                "id": "fadaae59-b18c-44d1-993f-fe8a281bd69c",
                "displayName": null
            }
        },
        "lastModifiedBy": {
            "application": null,
            "device": null,
            "user": {
                "id": "fadaae59-b18c-44d1-993f-fe8a281bd69c",
                "displayName": null
            }
        }
    }
}

示例 8:创建 educationLinkedAssignmentResource

请求

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

POST https://graph.microsoft.com/v1.0/education/classes/37d99af7-cfc5-4e3b-8566-f7d40e4a2070/modules/1babf0b0-c885-4f9d-b008-5b0de0cb835d/resources
Content-type: application/json

{
    "resource": {
        "@odata.type": "#microsoft.graph.educationLinkedAssignmentResource",
        "displayName": "2024-01-19T17_54_38_711Z",
        "url": "https://graph.microsoft.com/v1.0/education/classes/37d99af7-cfc5-4e3b-8566-f7d40e4a2070/assignments/b6a1d277-fed7-4345-940e-3f2ce13eb737"
    }
}

响应

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

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

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

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#education/classes('37d99af7-cfc5-4e3b-8566-f7d40e4a2070')/modules('1babf0b0-c885-4f9d-b008-5b0de0cb835d')/resources/$entity",
    "id": "de9018cb-6445-40bf-a425-3f150e059dd6",
    "resource": {
        "@odata.type": "#microsoft.graph.educationLinkedAssignmentResource",
        "displayName": "2024-01-19T17_54_38_711Z",
        "createdDateTime": "2024-01-18T17:56:19.8568259Z",
        "lastModifiedDateTime": "2024-01-18T17:56:19.856827Z",
        "url": "https://graph.microsoft.com/v1.0/education/classes/37d99af7-cfc5-4e3b-8566-f7d40e4a2070/assignments/b6a1d277-fed7-4345-940e-3f2ce13eb737/",
        "createdBy": {
            "application": null,
            "device": null,
            "user": {
                "id": "fadaae59-b18c-44d1-993f-fe8a281bd69c",
                "displayName": null
            }
        },
        "lastModifiedBy": {
            "application": null,
            "device": null,
            "user": {
                "id": "fadaae59-b18c-44d1-993f-fe8a281bd69c",
                "displayName": null
            }
        }
    }
}