Create educationSubmissionResource

Namespace: microsoft.graph

Important

APIs under the /beta version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.

Add a educationSubmissionResource to a submission resource list.

Only teachers and students can perform this operation.

The operation will not succeed if the allowStudentsToAddResources flag is not set to true.

To create a new file-based resource, upload the file to the resources folder associated with the submission. If the file doesn't exist or is not in that folder, the POST request will fail.

Important

Before you can upload an assignment resource, you must set up the resources folder for the educationAssignment to upload the files to.

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) EduAssignments.ReadWriteBasic EduAssignments.ReadWrite
Delegated (personal Microsoft account) Not supported. Not supported.
Application Not supported. Not supported.

HTTP request

POST /education/classes/{class-id}/assignments/{assignment-id}/submissions/{submission-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 the resource. The following are the supported types:

Note: The educationExternalResource is only an out resource, you can't POST a submission with it.

The assignmentResourceUrl isn't required in the request body, it's a read-only property.

Response

If successful, this method returns a 201 Created response code and an object according to the resource type in the response body.

Examples

Example 1: Create an educationWordResource

Request

The following example shows a request.

POST https://graph.microsoft.com/beta/education/classes/f4a941ff-9da6-4707-ba5b-0eae93cad0b4/assignments/3c77de7f-539b-49e1-9c96-1274f2f0ee3b/submissions/4af73d2b-6b9c-493f-0688-979087bed39b/resources
Content-type: application/json

{
    "resource": {
        "@odata.type": "microsoft.graph.educationWordResource",
        "displayName": "Report.docx",
        "fileUrl": "https://graph.microsoft.com/beta/drives/b!DPA6q59Tw0mtgmyXRUmrQRqBZTesG-lMkl1cBmvvMeUEWrOk89nKRpUEr4ZhNYBc/items/016XPCQEELISJB7NVNVBAK7V4UIF6Q27U2"
    }
}

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/beta/$metadata#education/classes('f4a941ff-9da6-4707-ba5b-0eae93cad0b4')/assignments('3c77de7f-539b-49e1-9c96-1274f2f0ee3b')/submissions('4af73d2b-6b9c-493f-0688-979087bed39b')/resources/$entity",
    "assignmentResourceUrl": null,
    "id": "d835503f-fd00-4840-b69c-7230d10e18b8",
    "resource": {
        "@odata.type": "#microsoft.graph.educationWordResource",
        "displayName": "Report.docx",
        "createdDateTime": "2021-08-04T00:23:08.6269586Z",
        "lastModifiedDateTime": "2021-08-04T00:23:08.6269586Z",
        "fileUrl": "https://graph.microsoft.com/beta/drives/b!DPA6q59Tw0mtgmyXRUmrQRqBZTesG-lMkl1cBmvvMeUEWrOk89nKRpUEr4ZhNYBc/items/016XPCQEELISJB7NVNVBAK7V4UIF6Q27U2",
        "createdBy": {
            "application": null,
            "device": null,
            "user": {
                "id": "80cefd93-8d88-40e2-b5d3-67898383e226",
                "displayName": null
            }
        },
        "lastModifiedBy": {
            "application": null,
            "device": null,
            "user": {
                "id": "80cefd93-8d88-40e2-b5d3-67898383e226",
                "displayName": null
            }
        }
    }
}

Example 2: Create an educationLinkResource

Request

The following example shows a request.

POST https://graph.microsoft.com/beta/education/classes/72a7baec-c3e9-4213-a850-f62de0adad5f/assignments/1618dfb0-3ff2-4edf-8d5c-b8f81df00e80/submissions/da443246-384d-673b-32db-bdba9d7f2b51/resources
Content-type: application/json

{
	"resource": {
		"displayName": "Wikipedia",
		"link": "https://en.wikipedia.org/wiki/Main_Page",
		"@odata.type": "#microsoft.graph.educationLinkResource"
	}
}

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/beta/$metadata#education/classes('72a7baec-c3e9-4213-a850-f62de0adad5f')/assignments('1618dfb0-3ff2-4edf-8d5c-b8f81df00e80')/submissions('da443246-384d-673b-32db-bdba9d7f2b51')/resources/$entity",
	"assignmentResourceUrl": null,
	"id": "88b441b0-cb05-45ab-a0f0-139f978e0993",
	"resource": {
		"@odata.type": "#microsoft.graph.educationLinkResource",
		"displayName": "Wikipedia",
		"createdDateTime": "2021-09-13T19:20:46.0648354Z",
		"lastModifiedDateTime": "2021-09-13T19:20:46.0648354Z",
		"link": "https://en.wikipedia.org/wiki/Main_Page",
		"createdBy": {
			"application": null,
			"device": null,
			"user": {
				"id": "80cefd93-8d88-40e2-b5d3-67898383e226",
				"displayName": null
			}
		},
		"lastModifiedBy": {
			"application": null,
			"device": null,
			"user": {
				"id": "80cefd93-8d88-40e2-b5d3-67898383e226",
				"displayName": null
			}
		}
	}
}

Example 3: Create an educationFileResource

Request

The following example shows a request.

POST https://graph.microsoft.com/beta/education/classes/72a7baec-c3e9-4213-a850-f62de0adad5f/assignments/1618dfb0-3ff2-4edf-8d5c-b8f81df00e80/submissions/da443246-384d-673b-32db-bdba9d7f2b51/resources
Content-type: application/json

{
	"resource": {
		"displayName": "_FTP_EDC-61424749-250820211136.pdf",
		"fileUrl": "https://graph.microsoft.com/beta/drives/b!OPmUsPgnBUiMIXMxWcj3neC1xck6I5NIsnFxfrLdmXodJYOAkI7rTLhw7ME_e42J/items/01QTY63RL45XVPGDBRW5FLDR62Z5TCMGG3",
		"@odata.type": "#microsoft.graph.educationFileResource"
	}
}

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/beta/$metadata#education/classes('72a7baec-c3e9-4213-a850-f62de0adad5f')/assignments('1618dfb0-3ff2-4edf-8d5c-b8f81df00e80')/submissions('da443246-384d-673b-32db-bdba9d7f2b51')/resources/$entity",
	"assignmentResourceUrl": null,
	"id": "33cf3eb2-8a35-4f76-8f16-b2abc112d44f",
	"resource": {
		"@odata.type": "#microsoft.graph.educationFileResource",
		"displayName": "_FTP_EDC-61424749-250820211136.pdf",
		"createdDateTime": "2021-09-13T19:23:04.5049139Z",
		"lastModifiedDateTime": "2021-09-13T19:23:04.5049139Z",
		"fileUrl": "https://graph.microsoft.com/beta/drives/b!OPmUsPgnBUiMIXMxWcj3neC1xck6I5NIsnFxfrLdmXodJYOAkI7rTLhw7ME_e42J/items/01QTY63RL45XVPGDBRW5FLDR62Z5TCMGG3",
		"createdBy": {
			"application": null,
			"device": null,
			"user": {
				"id": "80cefd93-8d88-40e2-b5d3-67898383e226",
				"displayName": null
			}
		},
		"lastModifiedBy": {
			"application": null,
			"device": null,
			"user": {
				"id": "80cefd93-8d88-40e2-b5d3-67898383e226",
				"displayName": null
			}
		}
	}
}

Example 4: Create an educationExcelResource

Request

The following example shows a request.

POST https://graph.microsoft.com/beta/education/classes/72a7baec-c3e9-4213-a850-f62de0adad5f/assignments/1618dfb0-3ff2-4edf-8d5c-b8f81df00e80/submissions/da443246-384d-673b-32db-bdba9d7f2b51/resources
Content-type: application/json

{
	"resource": {
		"@odata.type": "#microsoft.graph.educationExcelResource",
		"displayName": "userAgeGroup QueryParameter Test.xlsx",
		"fileUrl": "https://graph.microsoft.com/beta/drives/b!OPmUsPgnBUiMIXMxWcj3neC1xck6I5NIsnFxfrLdmXodJYOAkI7rTLhw7ME_e42J/items/01QTY63RONPUDM2CZKNRF3TGHYUM7Z64WE"
	}
}

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/beta/$metadata#education/classes('72a7baec-c3e9-4213-a850-f62de0adad5f')/assignments('1618dfb0-3ff2-4edf-8d5c-b8f81df00e80')/submissions('da443246-384d-673b-32db-bdba9d7f2b51')/resources/$entity",
	"assignmentResourceUrl": null,
	"id": "c36626ba-9864-4f3a-8d6f-7104f62df605",
	"resource": {
		"@odata.type": "#microsoft.graph.educationExcelResource",
		"displayName": "userAgeGroup QueryParameter Test.xlsx",
		"createdDateTime": "2021-09-13T19:23:58.3925618Z",
		"lastModifiedDateTime": "2021-09-13T19:23:58.3925618Z",
		"fileUrl": "https://graph.microsoft.com/beta/drives/b!OPmUsPgnBUiMIXMxWcj3neC1xck6I5NIsnFxfrLdmXodJYOAkI7rTLhw7ME_e42J/items/01QTY63RONPUDM2CZKNRF3TGHYUM7Z64WE",
		"createdBy": {
			"application": null,
			"device": null,
			"user": {
				"id": "80cefd93-8d88-40e2-b5d3-67898383e226",
				"displayName": null
			}
		},
		"lastModifiedBy": {
			"application": null,
			"device": null,
			"user": {
				"id": "80cefd93-8d88-40e2-b5d3-67898383e226",
				"displayName": null
			}
		}
	}
}

Example 5: Create an educationPowerPointResource

Request

The following example shows a request.

POST https://graph.microsoft.com/beta/education/classes/72a7baec-c3e9-4213-a850-f62de0adad5f/assignments/1618dfb0-3ff2-4edf-8d5c-b8f81df00e80/submissions/da443246-384d-673b-32db-bdba9d7f2b51/resources
Content-type: application/json

{
	"resource": {
		"@odata.type": "#microsoft.graph.educationPowerPointResource",
		"displayName": "state diagram.pptx",
		"fileUrl": "https://graph.microsoft.com/beta/drives/b!OPmUsPgnBUiMIXMxWcj3neC1xck6I5NIsnFxfrLdmXodJYOAkI7rTLhw7ME_e42J/items/01QTY63RN3MHWWM7BNXJD2UD5OMRFEDKN2"
	}
}

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/beta/$metadata#education/classes('72a7baec-c3e9-4213-a850-f62de0adad5f')/assignments('1618dfb0-3ff2-4edf-8d5c-b8f81df00e80')/submissions('da443246-384d-673b-32db-bdba9d7f2b51')/resources/$entity",
	"assignmentResourceUrl": null,
	"id": "e19bd829-17ee-4483-88d0-f62b406f367c",
	"resource": {
		"@odata.type": "#microsoft.graph.educationPowerPointResource",
		"displayName": "state diagram.pptx",
		"createdDateTime": "2021-09-13T19:24:38.4706263Z",
		"lastModifiedDateTime": "2021-09-13T19:24:38.4706263Z",
		"fileUrl": "https://graph.microsoft.com/beta/drives/b!OPmUsPgnBUiMIXMxWcj3neC1xck6I5NIsnFxfrLdmXodJYOAkI7rTLhw7ME_e42J/items/01QTY63RN3MHWWM7BNXJD2UD5OMRFEDKN2",
		"createdBy": {
			"application": null,
			"device": null,
			"user": {
				"id": "80cefd93-8d88-40e2-b5d3-67898383e226",
				"displayName": null
			}
		},
		"lastModifiedBy": {
			"application": null,
			"device": null,
			"user": {
				"id": "80cefd93-8d88-40e2-b5d3-67898383e226",
				"displayName": null
			}
		}
	}
}

Example 6: Create an educationMediaResource

Request

The following example shows a request.

POST https://graph.microsoft.com/beta/education/classes/72a7baec-c3e9-4213-a850-f62de0adad5f/assignments/1618dfb0-3ff2-4edf-8d5c-b8f81df00e80/submissions/da443246-384d-673b-32db-bdba9d7f2b51/resources
Content-type: application/json

{
	"resource": {
		"displayName": "category.jpg",
		"fileUrl": "https://graph.microsoft.com/beta/drives/b!OPmUsPgnBUiMIXMxWcj3neC1xck6I5NIsnFxfrLdmXodJYOAkI7rTLhw7ME_e42J/items/01QTY63RK2WLKUUBAA4ZBKXNBL6QFC2TKG",
		"@odata.type": "#microsoft.graph.educationMediaResource"
	}
}

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/beta/$metadata#education/classes('72a7baec-c3e9-4213-a850-f62de0adad5f')/assignments('1618dfb0-3ff2-4edf-8d5c-b8f81df00e80')/submissions('da443246-384d-673b-32db-bdba9d7f2b51')/resources/$entity",
    "assignmentResourceUrl": null,
    "id": "31f2c67a-6df1-4a7f-b4c5-311fe15c873a",
    "resource": {
        "@odata.type": "#microsoft.graph.educationMediaResource",
        "displayName": "category.jpg",
        "createdDateTime": "2021-09-16T19:07:59.4982929Z",
        "lastModifiedDateTime": "2021-09-16T19:07:59.4982929Z",
        "fileUrl": "https://graph.microsoft.com/beta/drives/b!OPmUsPgnBUiMIXMxWcj3neC1xck6I5NIsnFxfrLdmXodJYOAkI7rTLhw7ME_e42J/items/01QTY63RK2WLKUUBAA4ZBKXNBL6QFC2TKG",
        "createdBy": {
            "application": null,
            "device": null,
            "user": {
                "id": "80cefd93-8d88-40e2-b5d3-67898383e226",
                "displayName": null
            }
        },
        "lastModifiedBy": {
            "application": null,
            "device": null,
            "user": {
                "id": "80cefd93-8d88-40e2-b5d3-67898383e226",
                "displayName": null
            }
        }
    }
}