educationassignment の更新
-
[アーティクル]
-
-
名前空間: microsoft.graph
educationAssignment オブジェクトを更新します。
このアクションを実行できるのは教師のみです。
または、発行アクションを使用して割り当ての状態 を変更する要求を行います。 この目的のために PATCH 操作を使用しない。
アクセス許可
この API を呼び出すには、次のいずれかのアクセス許可が必要です。アクセス許可の選択方法などの詳細については、「アクセス許可」を参照してください。
| アクセス許可の種類 |
アクセス許可 (特権の小さいものから大きいものへ) |
| 委任 (職場または学校のアカウント) |
EduAssignments.ReadWriteBasic, EduAssignments.ReadWrite |
| 委任 (個人用 Microsoft アカウント) |
サポートされていません。 |
| アプリケーション |
サポートされていません。 |
HTTP 要求
PATCH /education/classes/{class-id}/assignments/{assignment-id}
| ヘッダー |
値 |
| Authorization |
ベアラー {token}。必須。 |
| Content-Type |
application/json |
要求本文
要求本文で、更新するフィールドの値のみを指定します。
要求本文に含まれない既存のプロパティは、以前の値のままになるか、他のプロパティ値の変化に基づいて再計算されます。 最適なパフォーマンスを得るために、変更されていない既存の値を含めないでください。
| プロパティ |
型 |
説明 |
| addedStudentAction |
String |
割り当ての発行日の後に追加された学生に割り当てを配布する必要がある場合について説明します。 |
| addToCalendarAction |
educationAddToCalendarOptions |
割り当てを 公開するときに、 学生と教師の予定表に割り当てを追加する割り当ての 動作を制御 するオプション フィールド。 使用可能な値: none、studentsAndPublisher、studentsAndTeamOwners、unknownFutureValue、studentsOnly。 この進化可能な列挙型Prefer: include - unknown -enum-membersで次の値を取得するには、要求ヘッダーを使用する必要があります。 studentsOnly オプション。 |
| allowLateSubmissions |
Boolean |
学生が期日後に提出を送信できるかどうか。 |
| allowStudentsToAddResourcesToSubmission |
Boolean |
学生が申請にリソースを追加できるかどうか。 また、申請のすべてのリソースが割り当てリソース リストに対応するかどうかを示します。 |
| assignDateTime |
DateTimeOffset |
学生に割り当てを発行する日付を示します。 割り当てが発行された後は編集できません。 |
| assignTo |
educationAssignmentRecipient |
課題を取得する学生。 |
| closeDateTime |
DateTimeOffset |
提出のために割り当てが終了する日付。 これは、割り当てがLateSubmissionsを許可しない場合、または closeDateTime が dueDateTime と同じで、指定した場合は dueDateTime 以上である必要がある場合は、null を指定できるオプションのフィールドです。 |
| displayName |
String |
割り当ての名前。 |
| dueDateTime |
DateTimeOffset |
日付の割り当てが期限です。 |
| グレーディング |
educationAssignmentGradeType |
割り当ての採点方法。 |
| 手順 |
itemBody |
課題と一緒に生徒に与えられる指示。 |
| notificationChannelUrl |
String |
割り当てに関連する通知を通信するチャネル。 URL を変更するには、educationAssignmentClassRecipientassignTo に値を設定します。 割り当ての発行後にチャネル URL を変更できない。 |
応答
成功した場合、このメソッドは応答 200 OK コードと、応答本文で 更新された educationAssignment オブジェクトを返します。
例
要求
要求の例を次に示します。
PATCH https://graph.microsoft.com/v1.0/education/classes/72a7baec-c3e9-4213-a850-f62de0adad5f/assignments/4679bc1b-90c5-45af-ae1a-d5357672ed39
Content-type: application/json
{
"displayName": "Reading and review test 09.03 #5",
"instructions": {
"contentType": "text",
"content": "Read chapter 5 and write your review"
},
"dueDateTime": "2021-09-10T00:00:00Z",
"addedStudentAction": "none"
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var educationAssignment = new EducationAssignment
{
DisplayName = "Reading and review test 09.03 #5",
Instructions = new EducationItemBody
{
ContentType = BodyType.Text,
Content = "Read chapter 5 and write your review"
},
DueDateTime = DateTimeOffset.Parse("2021-09-10T00:00:00Z"),
AddedStudentAction = EducationAddedStudentAction.None
};
await graphClient.Education.Classes["{educationClass-id}"].Assignments["{educationAssignment-id}"]
.Request()
.UpdateAsync(educationAssignment);
SDK をプロジェクトに追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
const options = {
authProvider,
};
const client = Client.init(options);
const educationAssignment = {
displayName: 'Reading and review test 09.03 #5',
instructions: {
contentType: 'text',
content: 'Read chapter 5 and write your review'
},
dueDateTime: '2021-09-10T00:00:00Z',
addedStudentAction: 'none'
};
await client.api('/education/classes/72a7baec-c3e9-4213-a850-f62de0adad5f/assignments/4679bc1b-90c5-45af-ae1a-d5357672ed39')
.update(educationAssignment);
SDK をプロジェクトに追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/v1.0/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/education/classes/72a7baec-c3e9-4213-a850-f62de0adad5f/assignments/4679bc1b-90c5-45af-ae1a-d5357672ed39"]]];
[urlRequest setHTTPMethod:@"PATCH"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
MSGraphEducationAssignment *educationAssignment = [[MSGraphEducationAssignment alloc] init];
[educationAssignment setDisplayName:@"Reading and review test 09.03 #5"];
MSGraphEducationItemBody *instructions = [[MSGraphEducationItemBody alloc] init];
[instructions setContentType: [MSGraphBodyType text]];
[instructions setContent:@"Read chapter 5 and write your review"];
[educationAssignment setInstructions:instructions];
[educationAssignment setDueDateTime: "2021-09-10T00:00:00Z"];
[educationAssignment setAddedStudentAction: [MSGraphEducationAddedStudentAction none]];
NSError *error;
NSData *educationAssignmentData = [educationAssignment getSerializedDataWithError:&error];
[urlRequest setHTTPBody:educationAssignmentData];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
//Request Completed
}];
[meDataTask execute];
SDK をプロジェクトに追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
EducationAssignment educationAssignment = new EducationAssignment();
educationAssignment.displayName = "Reading and review test 09.03 #5";
EducationItemBody instructions = new EducationItemBody();
instructions.contentType = BodyType.TEXT;
instructions.content = "Read chapter 5 and write your review";
educationAssignment.instructions = instructions;
educationAssignment.dueDateTime = OffsetDateTimeSerializer.deserialize("2021-09-10T00:00:00Z");
educationAssignment.addedStudentAction = EducationAddedStudentAction.NONE;
graphClient.education().classes("72a7baec-c3e9-4213-a850-f62de0adad5f").assignments("4679bc1b-90c5-45af-ae1a-d5357672ed39")
.buildRequest()
.patch(educationAssignment);
SDK をプロジェクトに追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
requestBody := msgraphsdk.NewEducationAssignment()
displayName := "Reading and review test 09.03 #5"
requestBody.SetDisplayName(&displayName)
instructions := msgraphsdk.NewEducationItemBody()
requestBody.SetInstructions(instructions)
contentType := "text"
instructions.SetContentType(&contentType)
content := "Read chapter 5 and write your review"
instructions.SetContent(&content)
dueDateTime, err := time.Parse(time.RFC3339, "2021-09-10T00:00:00Z")
requestBody.SetDueDateTime(&dueDateTime)
addedStudentAction := "none"
requestBody.SetAddedStudentAction(&addedStudentAction)
educationClassId := "educationClass-id"
educationAssignmentId := "educationAssignment-id"
graphClient.Education().ClassesById(&educationClassId).AssignmentsById(&educationAssignmentId).Patch(requestBody)
SDK をプロジェクトに追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
Import-Module Microsoft.Graph.Education
$params = @{
DisplayName = "Reading and review test 09.03 #5"
Instructions = @{
ContentType = "text"
Content = "Read chapter 5 and write your review"
}
DueDateTime = [System.DateTime]::Parse("2021-09-10T00:00:00Z")
AddedStudentAction = "none"
}
Update-MgEducationClassAssignment -EducationClassId $educationClassId -EducationAssignmentId $educationAssignmentId -BodyParameter $params
SDK をプロジェクトに追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
応答
応答の例を次に示します。
注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#education/classes('72a7baec-c3e9-4213-a850-f62de0adad5f')/assignments/$entity",
"classId": "72a7baec-c3e9-4213-a850-f62de0adad5f",
"displayName": "Reading and review test 09.03 #5",
"closeDateTime": null,
"dueDateTime": "2021-09-10T00:00:00Z",
"assignDateTime": null,
"assignedDateTime": null,
"allowLateSubmissions": true,
"resourcesFolderUrl": null,
"createdDateTime": "2021-09-03T23:57:14.6088791Z",
"lastModifiedDateTime": "2021-09-04T15:01:35.3361649Z",
"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%2272a7baec-c3e9-4213-a850-f62de0adad5f%5C%22,%5C%22displayName%5C%22%3Anull,%5C%22assignmentIds%5C%22%3A%5B%5C%224679bc1b-90c5-45af-ae1a-d5357672ed39%5C%22%5D%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",
"addedStudentAction": "none",
"id": "4679bc1b-90c5-45af-ae1a-d5357672ed39",
"instructions": {
"content": "Read chapter 5 and write your review",
"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
}
}
}
関連項目