名前空間: microsoft.graph
新しい割り当てを作成します。
課題を作成できるのは、クラスの教師だけです。 課題は下書きの状態で開始されます。つまり、学生は課題が発行されるまで表示されません。
この API は、次の国内クラウド展開で使用できます。
グローバル サービス |
米国政府機関 L4 |
米国政府機関 L5 (DOD) |
21Vianet が運営する中国 |
✅ |
❌ |
❌ |
❌ |
アクセス許可
この API の最小特権としてマークされているアクセス許可またはアクセス許可を選択します。
アプリで必要な場合にのみ、より高い特権のアクセス許可またはアクセス許可を使用します。 委任されたアクセス許可とアプリケーションのアクセス許可の詳細については、「アクセス許可の種類」を参照してください。 これらのアクセス許可の詳細については、「アクセス許可のリファレンス」を参照してください。
アクセス許可の種類 |
最小特権アクセス許可 |
より高い特権のアクセス許可 |
委任 (職場または学校のアカウント) |
EduAssignments.ReadWriteBasic |
EduAssignments.ReadWrite |
委任 (個人用 Microsoft アカウント) |
サポートされていません。 |
サポートされていません。 |
アプリケーション |
サポートされていません。 |
サポートされていません。 |
HTTP 要求
POST /education/classes/{class-id}/assignments
ヘッダー |
値 |
Authorization |
ベアラー {token}。 必須です。
認証と認可についての詳細をご覧ください。 |
Content-Type |
application/json |
要求本文
要求本文で、 educationAssignment オブジェクトの JSON 表現を指定します。
応答
成功した場合、このメソッドは応答コード 201 Created
と、応答本文に educationAssignment オブジェクトを返します。
例
要求
次の例は要求を示しています。
POST https://graph.microsoft.com/v1.0/education/classes/72a7baec-c3e9-4213-a850-f62de0adad5f/assignments
Content-type: application/json
{
"dueDateTime": "2022-09-16T00:00:00Z",
"displayName": "Reading test 09.14",
"instructions": {
"contentType": "text",
"content": "Read chapter 4"
},
"grading": {
"@odata.type": "#microsoft.graph.educationAssignmentPointsGradeType",
"maxPoints": 50
},
"assignTo": {
"@odata.type": "#microsoft.graph.educationAssignmentClassRecipient"
},
"status": "draft",
"allowStudentsToAddResourcesToSubmission": true
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new EducationAssignment
{
DueDateTime = DateTimeOffset.Parse("2022-09-16T00:00:00Z"),
DisplayName = "Reading test 09.14",
Instructions = new EducationItemBody
{
ContentType = BodyType.Text,
Content = "Read chapter 4",
},
Grading = new EducationAssignmentPointsGradeType
{
OdataType = "#microsoft.graph.educationAssignmentPointsGradeType",
MaxPoints = 50f,
},
AssignTo = new EducationAssignmentClassRecipient
{
OdataType = "#microsoft.graph.educationAssignmentClassRecipient",
},
Status = EducationAssignmentStatus.Draft,
AllowStudentsToAddResourcesToSubmission = true,
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Education.Classes["{educationClass-id}"].Assignments.PostAsync(requestBody);
プロジェクトに SDK を追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
mgc education classes assignments create --education-class-id {educationClass-id} --body '{\
"dueDateTime": "2022-09-16T00:00:00Z",\
"displayName": "Reading test 09.14",\
"instructions": {\
"contentType": "text",\
"content": "Read chapter 4"\
},\
"grading": {\
"@odata.type": "#microsoft.graph.educationAssignmentPointsGradeType",\
"maxPoints": 50\
},\
"assignTo": {\
"@odata.type": "#microsoft.graph.educationAssignmentClassRecipient"\
},\
"status": "draft",\
"allowStudentsToAddResourcesToSubmission": true\
}\
'
プロジェクトに SDK を追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
"time"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewEducationAssignment()
dueDateTime , err := time.Parse(time.RFC3339, "2022-09-16T00:00:00Z")
requestBody.SetDueDateTime(&dueDateTime)
displayName := "Reading test 09.14"
requestBody.SetDisplayName(&displayName)
instructions := graphmodels.NewEducationItemBody()
contentType := graphmodels.TEXT_BODYTYPE
instructions.SetContentType(&contentType)
content := "Read chapter 4"
instructions.SetContent(&content)
requestBody.SetInstructions(instructions)
grading := graphmodels.NewEducationAssignmentPointsGradeType()
maxPoints := float32(50)
grading.SetMaxPoints(&maxPoints)
requestBody.SetGrading(grading)
assignTo := graphmodels.NewEducationAssignmentClassRecipient()
requestBody.SetAssignTo(assignTo)
status := graphmodels.DRAFT_EDUCATIONASSIGNMENTSTATUS
requestBody.SetStatus(&status)
allowStudentsToAddResourcesToSubmission := true
requestBody.SetAllowStudentsToAddResourcesToSubmission(&allowStudentsToAddResourcesToSubmission)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
assignments, err := graphClient.Education().Classes().ByEducationClassId("educationClass-id").Assignments().Post(context.Background(), requestBody, nil)
プロジェクトに SDK を追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
EducationAssignment educationAssignment = new EducationAssignment();
OffsetDateTime dueDateTime = OffsetDateTime.parse("2022-09-16T00:00:00Z");
educationAssignment.setDueDateTime(dueDateTime);
educationAssignment.setDisplayName("Reading test 09.14");
EducationItemBody instructions = new EducationItemBody();
instructions.setContentType(BodyType.Text);
instructions.setContent("Read chapter 4");
educationAssignment.setInstructions(instructions);
EducationAssignmentPointsGradeType grading = new EducationAssignmentPointsGradeType();
grading.setOdataType("#microsoft.graph.educationAssignmentPointsGradeType");
grading.setMaxPoints(50f);
educationAssignment.setGrading(grading);
EducationAssignmentClassRecipient assignTo = new EducationAssignmentClassRecipient();
assignTo.setOdataType("#microsoft.graph.educationAssignmentClassRecipient");
educationAssignment.setAssignTo(assignTo);
educationAssignment.setStatus(EducationAssignmentStatus.Draft);
educationAssignment.setAllowStudentsToAddResourcesToSubmission(true);
EducationAssignment result = graphClient.education().classes().byEducationClassId("{educationClass-id}").assignments().post(educationAssignment);
プロジェクトに SDK を追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
const options = {
authProvider,
};
const client = Client.init(options);
const educationAssignment = {
dueDateTime: '2022-09-16T00:00:00Z',
displayName: 'Reading test 09.14',
instructions: {
contentType: 'text',
content: 'Read chapter 4'
},
grading: {
'@odata.type': '#microsoft.graph.educationAssignmentPointsGradeType',
maxPoints: 50
},
assignTo: {
'@odata.type': '#microsoft.graph.educationAssignmentClassRecipient'
},
status: 'draft',
allowStudentsToAddResourcesToSubmission: true
};
await client.api('/education/classes/72a7baec-c3e9-4213-a850-f62de0adad5f/assignments')
.post(educationAssignment);
プロジェクトに SDK を追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\EducationAssignment;
use Microsoft\Graph\Generated\Models\EducationItemBody;
use Microsoft\Graph\Generated\Models\BodyType;
use Microsoft\Graph\Generated\Models\EducationAssignmentPointsGradeType;
use Microsoft\Graph\Generated\Models\EducationAssignmentClassRecipient;
use Microsoft\Graph\Generated\Models\EducationAssignmentStatus;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new EducationAssignment();
$requestBody->setDueDateTime(new \DateTime('2022-09-16T00:00:00Z'));
$requestBody->setDisplayName('Reading test 09.14');
$instructions = new EducationItemBody();
$instructions->setContentType(new BodyType('text'));
$instructions->setContent('Read chapter 4');
$requestBody->setInstructions($instructions);
$grading = new EducationAssignmentPointsGradeType();
$grading->setOdataType('#microsoft.graph.educationAssignmentPointsGradeType');
$grading->setMaxPoints(50);
$requestBody->setGrading($grading);
$assignTo = new EducationAssignmentClassRecipient();
$assignTo->setOdataType('#microsoft.graph.educationAssignmentClassRecipient');
$requestBody->setAssignTo($assignTo);
$requestBody->setStatus(new EducationAssignmentStatus('draft'));
$requestBody->setAllowStudentsToAddResourcesToSubmission(true);
$result = $graphServiceClient->education()->classes()->byEducationClassId('educationClass-id')->assignments()->post($requestBody)->wait();
プロジェクトに SDK を追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
Import-Module Microsoft.Graph.Education
$params = @{
dueDateTime = [System.DateTime]::Parse("2022-09-16T00:00:00Z")
displayName = "Reading test 09.14"
instructions = @{
contentType = "text"
content = "Read chapter 4"
}
grading = @{
"@odata.type" = "#microsoft.graph.educationAssignmentPointsGradeType"
maxPoints =
}
assignTo = @{
"@odata.type" = "#microsoft.graph.educationAssignmentClassRecipient"
}
status = "draft"
allowStudentsToAddResourcesToSubmission = $true
}
New-MgEducationClassAssignment -EducationClassId $educationClassId -BodyParameter $params
プロジェクトに SDK を追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.education_assignment import EducationAssignment
from msgraph.generated.models.education_item_body import EducationItemBody
from msgraph.generated.models.body_type import BodyType
from msgraph.generated.models.education_assignment_points_grade_type import EducationAssignmentPointsGradeType
from msgraph.generated.models.education_assignment_class_recipient import EducationAssignmentClassRecipient
from msgraph.generated.models.education_assignment_status import EducationAssignmentStatus
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = EducationAssignment(
due_date_time = "2022-09-16T00:00:00Z",
display_name = "Reading test 09.14",
instructions = EducationItemBody(
content_type = BodyType.Text,
content = "Read chapter 4",
),
grading = EducationAssignmentPointsGradeType(
odata_type = "#microsoft.graph.educationAssignmentPointsGradeType",
max_points = 50,
),
assign_to = EducationAssignmentClassRecipient(
odata_type = "#microsoft.graph.educationAssignmentClassRecipient",
),
status = EducationAssignmentStatus.Draft,
allow_students_to_add_resources_to_submission = True,
)
result = await graph_client.education.classes.by_education_class_id('educationClass-id').assignments.post(request_body)
プロジェクトに SDK を追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
要求本文で、 educationAssignment オブジェクトの JSON 表現を指定します。
応答
次の例は応答を示しています。
注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。
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/$entity",
"classId": "f4a941ff-9da6-4707-ba5b-0eae93cad0b4",
"displayName": "Reading test 09.14",
"closeDateTime": null,
"dueDateTime": "2022-09-16T00:00:00Z",
"assignDateTime": null,
"assignedDateTime": null,
"allowLateSubmissions": true,
"resourcesFolderUrl": null,
"createdDateTime": "2022-09-14T21:23:17.8898549Z",
"lastModifiedDateTime": "2022-09-14T21:23:17.9055807Z",
"allowStudentsToAddResourcesToSubmission": true,
"status": "draft",
"notificationChannelUrl": null,
"webUrl": "https://teams.microsoft.com/l/entity/66aeee93-507d-479a-a3ef-8f494af43945/classroom?context=%7B%22subEntityId%22%3A%22%7B%5C%22version%5C%22%3A%5C%221.0%5C%22,%5C%22config%5C%22%3A%7B%5C%22classes%5C%22%3A%5B%7B%5C%22id%5C%22%3A%5C%22f4a941ff-9da6-4707-ba5b-0eae93cad0b4%5C%22,%5C%22displayName%5C%22%3Anull,%5C%22assignmentIds%5C%22%3A%5B%5C%22ea77e1dd-1e04-4051-967e-09129d42290f%5C%22%5D,%5C%22submissionId%5C%22%3Anull%7D%5D%7D,%5C%22action%5C%22%3A%5C%22navigate%5C%22,%5C%22view%5C%22%3A%5C%22assignment-viewer%5C%22%7D%22,%22channelId%22%3Anull%7D",
"addToCalendarAction": "none",
"addedStudentAction": "none",
"id": "ea77e1dd-1e04-4051-967e-09129d42290f",
"instructions": {
"content": "Read chapter 4",
"contentType": "text"
},
"grading": {
"@odata.type": "#microsoft.graph.educationAssignmentPointsGradeType",
"maxPoints": 50
},
"assignTo": {
"@odata.type": "#microsoft.graph.educationAssignmentClassRecipient"
},
"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
}
}
}
関連コンテンツ