educationSubmissionResource を作成する

名前空間: microsoft.graph

educationSubmissionResource を申請リソース リストに追加します。 この操作を実行できるのは、教師と学生だけです。

allowStudentsToAddResources フラグが true に設定されていない場合、操作は成功しません。

新しいファイル ベースのリソースを作成するには、提出に関連付けられている resources フォルダーにファイルをアップロードします。 ファイルが存在しないか、そのフォルダーにない場合、POST 要求は失敗します。

重要

割り当てリソースをアップロードする前に、educationAssignment の resources フォルダーを設定してファイルをアップロードする必要があります。

この API は、次の国内クラウド展開で使用できます。

グローバル サービス 米国政府機関 L4 米国政府機関 L5 (DOD) 21Vianet が運営する中国
✅ ❌ ❌ ❌

アクセス許可

この API の最小特権としてマークされているアクセス許可またはアクセス許可を選択します。 アプリで必要な場合にのみ、より高い特権のアクセス許可またはアクセス許可を使用します。 委任されたアクセス許可とアプリケーションのアクセス許可の詳細については、「アクセス許可の種類」を参照してください。 これらのアクセス許可の詳細については、「アクセス許可のリファレンス」を参照してください。

アクセス許可の種類 最小特権アクセス許可 より高い特権のアクセス許可
委任 (職場または学校のアカウント) EduAssignments.ReadWriteBasic EduAssignments.ReadWrite
委任 (個人用 Microsoft アカウント) サポートされていません。 サポートされていません。
アプリケーション サポートされていません。 サポートされていません。

HTTP 要求

POST /education/classes/{class-id}/assignments/{assignment-id}/submissions/{submission-id}/resources

要求ヘッダー

ヘッダー 値
Authorization ベアラー {token}。 必須です。 認証と認可についての詳細をご覧ください。
Content-Type application/json. 必須です。

要求本文

要求本文で、リソースの JSON 表現を指定します。 サポートされている型を次に示します。

手記:educationExternalResource は out リソースに過ぎません。申請を投稿することはできません。

assignmentResourceUrlは要求本文では必要ありません。これは読み取り専用プロパティです。

応答

成功した場合、このメソッドは 201 Created 応答コードと、応答本文のリソースの種類に従って オブジェクトを返します。

例

例 1: educationWordResource を作成する

要求

次の例は要求を示しています。

POST https://graph.microsoft.com/v1.0/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/v1.0/drives/b!DPA6q59Tw0mtgmyXRUmrQRqBZTesG-lMkl1cBmvvMeUEWrOk89nKRpUEr4ZhNYBc/items/016XPCQEELISJB7NVNVBAK7V4UIF6Q27U2"
    }
}

応答

次の例は応答を示しています。

注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。

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

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

例 2: educationLinkResource を作成する

要求

次の例は要求を示しています。

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

応答

次の例は応答を示しています。

注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。

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

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

例 3: educationFileResource を作成する

要求

次の例は要求を示しています。

POST https://graph.microsoft.com/v1.0/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/v1.0/drives/b!OPmUsPgnBUiMIXMxWcj3neC1xck6I5NIsnFxfrLdmXodJYOAkI7rTLhw7ME_e42J/items/01QTY63RL45XVPGDBRW5FLDR62Z5TCMGG3",
		"@odata.type": "#microsoft.graph.educationFileResource"
	}
}

応答

次の例は応答を示しています。

注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。

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

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

例 4: educationExcelResource を作成する

要求

次の例は要求を示しています。

POST https://graph.microsoft.com/v1.0/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/v1.0/drives/b!OPmUsPgnBUiMIXMxWcj3neC1xck6I5NIsnFxfrLdmXodJYOAkI7rTLhw7ME_e42J/items/01QTY63RONPUDM2CZKNRF3TGHYUM7Z64WE"
	}
}

応答

次の例は応答を示しています。

注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。

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

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

例 5: educationPowerPointResource を作成する

要求

次の例は要求を示しています。

POST https://graph.microsoft.com/v1.0/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/v1.0/drives/b!OPmUsPgnBUiMIXMxWcj3neC1xck6I5NIsnFxfrLdmXodJYOAkI7rTLhw7ME_e42J/items/01QTY63RN3MHWWM7BNXJD2UD5OMRFEDKN2"
	}
}

応答

次の例は応答を示しています。

注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。

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

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

例 6: educationMediaResource を作成する

要求

次の例は要求を示しています。

POST https://graph.microsoft.com/v1.0/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/v1.0/drives/b!OPmUsPgnBUiMIXMxWcj3neC1xck6I5NIsnFxfrLdmXodJYOAkI7rTLhw7ME_e42J/items/01QTY63RK2WLKUUBAA4ZBKXNBL6QFC2TKG",
		"@odata.type": "#microsoft.graph.educationMediaResource"
	}
}

応答

次の例は応答を示しています。

注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。

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

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