Create educationModuleResource

Namespace: microsoft.graph

Create a resource in a module. Only teachers can perform this operation.

You can create the following types of module resources:

Every resource has an @odata.type property to indicate which type of resource is being created.

Important

To upload a module resource, you need to first set up the resources folder for the educationModule where the files will be uploaded.

This API is available in the following national cloud deployments.

Global service US Government L4 US Government L5 (DOD) China operated by 21Vianet

Permissions

Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.

Permission type Least privileged permissions Higher privileged permissions
Delegated (work or school account) EduCurricula.ReadWrite Not available.
Delegated (personal Microsoft account) Not supported. Not supported.
Application EduCurricula.ReadWrite.All Not available.

HTTP request

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

Request headers

Header Value
Authorization Bearer {token}. Required. Learn more about authentication and authorization.
Content-Type application/json

Request body

In the request body, supply a JSON representation of one of the following resource types:

Note: You can't use this operation to create an educationExternalResource.

Response

If successful, this method returns a 201 Created response code and an educationModuleResource object in the response body.

Examples

Example 1: Create an educationLinkResource

Request

The following example shows a request.

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"
     }
}

Response

The following example shows the response.

Note: The response object shown here might be shortened for readability.

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
            }
        }
    }
}

Example 2: Create an educationWordResource

Request

The following example shows a request.

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"
        }
    }
}

Response

The following example shows the response.

Note: The response object shown here might be shortened for readability.

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
            }
        }
    }
}

Example 3: Create an educationFileResource

Request

The following example shows a request.

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"
        }
    }
}

Response

The following example shows the response.

Note: The response object shown here might be shortened for readability.

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
            }
        }
    }
}

Example 4: Create an educationExcelResource

Request

The following example shows a request.

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"
        }
    }
}

Response

The following example shows the response.

Note: The response object shown here might be shortened for readability.

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
            }
        }
    }
}

Example 5: Create an educationPowerPointResource

Request

The following example shows a request.

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"
    }
}

Response

The following example shows the response.

Note: The response object shown here might be shortened for readability.

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
            }
        }
    }
}

Example 6: Create an educationMediaResource

Request

The following example shows a request.

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"
    }
}

Response

The following example shows the response.

Note: The response object shown here might be shortened for readability.

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
            }
        }
    }
}

Example 7: Create an educationChannelResource

Request

The following example shows a request.

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"
    }
}

Response

The following example shows the response.

Note: The response object shown here might be shortened for readability.

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
            }
        }
    }
}

Example 8: Create an educationLinkedAssignmentResource

Request

The following example shows a request.

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"
    }
}

Response

The following example shows the response.

Note: The response object shown here might be shortened for readability.

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
            }
        }
    }
}