Criar educationAssignmentResource

Namespace: microsoft.graph

Crie um recurso de atribuição. Somente professores podem executar essa operação.

Você pode criar os seguintes tipos de recursos de atribuição:

Cada recurso tem uma propriedade @odata.type para indicar qual tipo de recurso está sendo criado.

Importante

Antes de carregar um recurso de atribuição, você deve configurar a pasta de recursos para o educationAssignment para carregar os arquivos.

Essa API está disponível nas seguintes implantações nacionais de nuvem.

Serviço global Governo dos EUA L4 GOVERNO DOS EUA L5 (DOD) China operada pela 21Vianet

Permissões

Escolha a permissão ou as permissões marcadas como menos privilegiadas para essa API. Use uma permissão ou permissões privilegiadas mais altas somente se o aplicativo exigir. Para obter detalhes sobre permissões delegadas e de aplicativo, consulte Tipos de permissão. Para saber mais sobre essas permissões, consulte a referência de permissões.

Tipo de permissão Permissões menos privilegiadas Permissões privilegiadas mais altas
Delegado (conta corporativa ou de estudante) EduAssignments.ReadWriteBasic EduAssignments.ReadWrite
Delegado (conta pessoal da Microsoft) Sem suporte. Sem suporte.
Aplicativo Sem suporte. Sem suporte.

Solicitação HTTP

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

Cabeçalhos de solicitação

Cabeçalho Valor
Autorização {token} de portador. Obrigatório. Saiba mais sobre autenticação e autorização.
Content-Type application/json. Obrigatório.

Corpo da solicitação

No corpo da solicitação, forneça uma representação JSON de um dos seguintes tipos de recurso:

Nota: Você não pode usar essa operação para criar um educationExternalResource.

Resposta

Se for bem-sucedido, esse método retornará um 201 Created código de resposta e um objeto educationAssignmentResource no corpo da resposta.

Exemplos

Exemplo 1: Criar um educationLinkResource

Solicitação

O exemplo a seguir mostra uma solicitação.

POST https://graph.microsoft.com/v1.0/education/classes/72a7baec-c3e9-4213-a850-f62de0adad5f/assignments/1618dfb0-3ff2-4edf-8d5c-b8f81df00e80/resources
Content-type: application/json

{
	"distributeForStudentWork": false,
	"resource": {
		"displayName": "Where the Wonders of Learning Never Cease | Wonderopolis",
		"link": "https://wonderopolis.org/",
		"thumbnailPreviewUrl": null,
		"@odata.type": "#microsoft.graph.educationLinkResource"
	}
}

Resposta

O exemplo a seguir mostra a resposta.

Observação: o objeto de resposta mostrado aqui pode ser encurtado para legibilidade.

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')/resources/$entity",
  "assignmentResourceUrl": null,  
	"id": "a2f95693-aea2-4d5e-a936-11ef390f8f20",
	"resource": {
		"@odata.type": "#microsoft.graph.educationLinkResource",
		"displayName": "Where the Wonders of Learning Never Cease | Wonderopolis",
		"createdDateTime": "2021-09-13T15:50:39.0017937Z",
		"lastModifiedDateTime": "2021-09-13T15:50:39.0017937Z",
		"link": "https://wonderopolis.org/",
		"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
			}
		}
	}
}

Exemplo 2: Criar um educationWordResource

Solicitação

O exemplo a seguir mostra uma solicitação.

POST https://graph.microsoft.com/v1.0/education/classes/72a7baec-c3e9-4213-a850-f62de0adad5f/assignments/1618dfb0-3ff2-4edf-8d5c-b8f81df00e80/resources
Content-type: application/json

{
    "distributeForStudentWork":false,
    "resource": {
        "@odata.type": "microsoft.graph.educationWordResource",
        "displayName": "Issues and PR in guthub.docx",
        "fileUrl": "https://graph.microsoft.com/v1.0/drives/b!DPA6q59Tw0mtgmyXRUmrQRqBZTesG-lMkl1cBmvvMeUEWrOk89nKRpUEr4ZhNYBc/items/016XPCQEELISJB7NVNVBAK7V4UIF6Q27U2"
										  
    }
}

Resposta

O exemplo a seguir mostra a resposta.

Observação: o objeto de resposta mostrado aqui pode ser encurtado para legibilidade.

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')/resources/$entity",
    "assignmentResourceUrl": null,
    "id": "d835503f-fd00-4840-b69c-7230d10e18b8",
    "resource": {
        "@odata.type": "#microsoft.graph.educationWordResource",
        "displayName": "Issues and PR in guthub.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
            }
        }
    }
}

Exemplo 3: Criar um educationFileResource

Solicitação

O exemplo a seguir mostra uma solicitação.

POST https://graph.microsoft.com/v1.0/education/classes/72a7baec-c3e9-4213-a850-f62de0adad5f/assignments/1618dfb0-3ff2-4edf-8d5c-b8f81df00e80/resources
Content-type: application/json

{
	"distributeForStudentWork":false,
	"resource": {
		"displayName": "article.pdf",
		"file": {
			"odataid": "https://graph.microsoft.com/v1.0/drives/b!OPmUsPgnBUiMIXMxWcj3neC1xck6I5NIsnFxfrLdmXoOOmEQNO79QpIMPdOmY3nf/items/01QTY63RPHKSP6THE4ORD2RQAR6MQLF26G"
		},
		"@odata.type": "#microsoft.graph.educationFileResource"
	}
}

Resposta

O exemplo a seguir mostra a resposta.

Observação: o objeto de resposta mostrado aqui pode ser encurtado para legibilidade.

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')/resources/$entity",
    "distributeForStudentWork": false,
    "id": "eec7f642-9d9a-406f-bbae-4b3b2c12e273",
    "resource": {
        "@odata.type": "#microsoft.graph.educationFileResource",
        "displayName": "article.pdf",
        "createdDateTime": "2021-07-16T23:41:53.9378423Z",
        "lastModifiedDateTime": "2021-07-16T23:41:53.9378423Z",
        "fileUrl": "https://graph.microsoft.com/v1.0/drives/b!DPA6q59Tw0mtgmyXRUmrQRqBZTesG-lMkl1cBmvvMeU6BLWBcGc_R6UgCKyYyTin/items/016XPCQEA5VVDIMU4BSFG3VBI37MPHZ3OE",
        "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
            }
        }
    }
}

Exemplo 4: Criar um educationExcelResource

Solicitação

O exemplo a seguir mostra uma solicitação.

POST https://graph.microsoft.com/v1.0/education/classes/72a7baec-c3e9-4213-a850-f62de0adad5f/assignments/1618dfb0-3ff2-4edf-8d5c-b8f81df00e80/resources
Content-type: application/json

{
    "distributeForStudentWork":false,
    "resource": {
        "@odata.type": "microsoft.graph.educationExcelResource",
        "displayName":"Graph Doc pages.xlsx",
        "fileUrl": "https://graph.microsoft.com/v1.0/drives/b!OPmUsPgnBUiMIXMxWcj3neC1xck6I5NIsnFxfrLdmXoOOmEQNO79QpIMPdOmY3nf/items/01QTY63RIR7PSV4JJSFJHKNPUVUWGPW4O2"
    }
}

Resposta

O exemplo a seguir mostra a resposta.

Observação: o objeto de resposta mostrado aqui pode ser encurtado para legibilidade.

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')/resources/$entity",
    "assignmentResourceUrl": null,
	"id": "517b36a6-9ca2-4e7b-9748-3af25f5cd4fd",
	"resource": {
		"@odata.type": "#microsoft.graph.educationExcelResource",
		"displayName": "Graph Doc pages.xlsx",
		"createdDateTime": "2021-09-13T15:50:49.7107759Z",
		"lastModifiedDateTime": "2021-09-13T15:50:49.7107759Z",
		"fileUrl": "https://graph.microsoft.com/v1.0/drives/b!OPmUsPgnBUiMIXMxWcj3neC1xck6I5NIsnFxfrLdmXoOOmEQNO79QpIMPdOmY3nf/items/01QTY63RIR7PSV4JJSFJHKNPUVUWGPW4O2",
		"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
			}
		}
	}
}

Exemplo 5: Criar um educationPowerPointResource

Solicitação

O exemplo a seguir mostra uma solicitação.

POST https://graph.microsoft.com/v1.0/education/classes/72a7baec-c3e9-4213-a850-f62de0adad5f/assignments/1618dfb0-3ff2-4edf-8d5c-b8f81df00e80/resources
Content-type: application/json

{
    "distributeForStudentWork":false,
    "resource": {
        "@odata.type": "microsoft.graph.educationPowerPointResource",
        "displayName":"state diagram.pptx",
        "fileUrl": "https://graph.microsoft.com/v1.0/drives/b!OPmUsPgnBUiMIXMxWcj3neC1xck6I5NIsnFxfrLdmXoOOmEQNO79QpIMPdOmY3nf/items/01QTY63RN327OXRN6EVFE2Q5FRJZTN5EOJ"
    }
}

Resposta

O exemplo a seguir mostra a resposta.

Observação: o objeto de resposta mostrado aqui pode ser encurtado para legibilidade.

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')/resources/$entity",
  "assignmentResourceUrl": null,
	"id": "3cb7968b-082f-4756-bdfb-782b4538cc0a",
	"resource": {
		"@odata.type": "#microsoft.graph.educationPowerPointResource",
    "displayName": "state diagram.pptx",
		"createdDateTime": "2021-09-13T15:50:58.5428117Z",
		"lastModifiedDateTime": "2021-09-13T15:50:58.5428117Z",
		"fileUrl": "https://graph.microsoft.com/v1.0/drives/b!OPmUsPgnBUiMIXMxWcj3neC1xck6I5NIsnFxfrLdmXoOOmEQNO79QpIMPdOmY3nf/items/01QTY63RN327OXRN6EVFE2Q5FRJZTN5EOJ",
		"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
			}
		}
	}
}

Exemplo 6: Criar um educationMediaResource

Solicitação

O exemplo a seguir mostra uma solicitação.

POST https://graph.microsoft.com/v1.0/education/classes/72a7baec-c3e9-4213-a850-f62de0adad5f/assignments/1618dfb0-3ff2-4edf-8d5c-b8f81df00e80/resources
Content-type: application/json

{
    "distributeForStudentWork":false,
    "resource": {
        "@odata.type": "microsoft.graph.educationMediaResource",
        "displayName":"homework example.PNG",
        "fileUrl": "https://graph.microsoft.com/v1.0/drives/b!OPmUsPgnBUiMIXMxWcj3neC1xck6I5NIsnFxfrLdmXoOOmEQNO79QpIMPdOmY3nf/items/01QTY63RMUWOKAGSJZ6BHINJVKNMOOJABF"
    }
}

Resposta

O exemplo a seguir mostra a resposta.

Observação: o objeto de resposta mostrado aqui pode ser encurtado para legibilidade.

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')/resources/$entity",
    "distributeForStudentWork": false,
    "id": "30495bfd-c912-49d5-b3e1-92b60db3142a",
    "resource": {
        "@odata.type": "#microsoft.graph.educationMediaResource",
        "displayName": "homework example.PNG",
        "createdDateTime": "2021-09-16T00:09:32.2133895Z",
        "lastModifiedDateTime": "2021-09-16T00:09:32.2133895Z",
        "fileUrl": "https://graph.microsoft.com/v1.0/drives/b!OPmUsPgnBUiMIXMxWcj3neC1xck6I5NIsnFxfrLdmXoOOmEQNO79QpIMPdOmY3nf/items/01QTY63RMUWOKAGSJZ6BHINJVKNMOOJABF",
        "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
            }
        }
    }
}

Exemplo 7: Criar um educationTeamsAppResource

Solicitação

O exemplo a seguir mostra uma solicitação.

POST https://graph.microsoft.com/v1.0/education/classes/2003c52e-807a-4186-9b49-60c573095461/assignments/820371a1-4589-4a4a-8b40-9d5db94b9186/resources
Content-type: application/json

{
    "distributeForStudentWork": false,
    "resource": {
        "displayName": "Template - My Story",
        "appId": "6fbeb90c-3d55-4bd5-82c4-bfe824be4300",
        "appIconWebUrl": "https://statics.teams.cdn.office.net/evergreen-assets/ThirdPartyApps/6fbeb90c-3d55-4bd5-82c4-bfe824be4300_largeImage.png?v=2.0.2",
        "teamsEmbeddedContentUrl": "https://app.api.edu.buncee.com/player/C7B0866C9B7E485EAE21AE14DBC3FD08?embed=1&render_slide_panel=1",
        "webUrl": "https://app.edu.buncee.com/buncee/C7B0866C9B7E485EAE21AE14DBC3FD08",
        "@odata.type": "#microsoft.graph.educationTeamsAppResource"
    }
}

Resposta

O exemplo a seguir mostra a resposta.

Observação: o objeto de resposta mostrado aqui pode ser encurtado para legibilidade.

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

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#education/classes('2003c52e-807a-4186-9b49-60c573095461')/assignments('820371a1-4589-4a4a-8b40-9d5db94b9186')/resources/$entity",
    "distributeForStudentWork": false,
    "id": "6821bff5-91e4-4b63-8f98-8157305ff004",
    "resource": {
        "@odata.type": "#microsoft.graph.educationTeamsAppResource",
        "displayName": "Template - My Story",
        "createdDateTime": "2022-12-01T16:35:58.0718192Z",
        "lastModifiedDateTime": "2022-12-01T16:35:58.0718396Z",
        "appId": "6fbeb90c-3d55-4bd5-82c4-bfe824be4300",
        "appIconWebUrl": "https://statics.teams.cdn.office.net/evergreen-assets/ThirdPartyApps/6fbeb90c-3d55-4bd5-82c4-bfe824be4300_largeImage.png?v=2.0.2",
        "teamsEmbeddedContentUrl": "https://app.api.edu.buncee.com/player/C7B0866C9B7E485EAE21AE14DBC3FD08?embed=1&render_slide_panel=1",
        "webUrl": "https://app.edu.buncee.com/buncee/C7B0866C9B7E485EAE21AE14DBC3FD08",
        "createdBy": {
            "application": null,
            "device": null,
            "user": {
                "id": "fffafb29-e8bc-4de3-8106-be76ed2ad499",
                "displayName": null
            }
        },
        "lastModifiedBy": {
            "application": null,
            "device": null,
            "user": {
                "id": "fffafb29-e8bc-4de3-8106-be76ed2ad499",
                "displayName": null
            }
        }
    }
}