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.
Create a new assignment.
Only teachers in a class can create an assignment. Assignments start in the Draft state, which means that students will not see the assignment until publication.
Permissions
One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.
var graphClient = new GraphServiceClient(requestAdapter);
var requestBody = new EducationAssignment
{
DueDateTime = DateTimeOffset.Parse("2022-09-16T00:00:00Z"),
DisplayName = "Reading test 09.14 Beta",
Instructions = new EducationItemBody
{
ContentType = BodyType.Text,
Content = "Read chapter 4",
},
Grading = new EducationAssignmentGradeType
{
OdataType = "#microsoft.graph.educationAssignmentPointsGradeType",
AdditionalData = new Dictionary<string, object>
{
{
"maxPoints" , 50
},
},
},
AssignTo = new EducationAssignmentRecipient
{
OdataType = "#microsoft.graph.educationAssignmentClassRecipient",
},
Status = EducationAssignmentStatus.Draft,
AllowStudentsToAddResourcesToSubmission = true,
};
var result = await graphClient.Education.Classes["{educationClass-id}"].Assignments.PostAsync(requestBody);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
<?php
// THIS SNIPPET IS A PREVIEW FOR THE KIOTA BASED SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($requestAdapter);
$requestBody = new EducationAssignment();
$requestBody->setDueDateTime(new DateTime('2022-09-16T00:00:00Z'));
$requestBody->setDisplayName('Reading test 09.14 Beta');
$instructions = new EducationItemBody();
$instructions->setContentType(new BodyType('text'));
$instructions->setContent('Read chapter 4');
$requestBody->setInstructions($instructions);
$grading = new EducationAssignmentGradeType();
$grading->set@odatatype('#microsoft.graph.educationAssignmentPointsGradeType');
$additionalData = [
'maxPoints' => 50,
];
$grading->setAdditionalData($additionalData);
$requestBody->setGrading($grading);
$assignTo = new EducationAssignmentRecipient();
$assignTo->set@odatatype('#microsoft.graph.educationAssignmentClassRecipient');
$requestBody->setAssignTo($assignTo);
$requestBody->setStatus(new EducationAssignmentStatus('draft'));
$requestBody->setAllowStudentsToAddResourcesToSubmission(true);
$requestResult = $graphServiceClient->education()->classesById('educationClass-id')->assignments()->post($requestBody);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.