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 draft status, which means that students can't see the assignment until it's published.
Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
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 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);
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.
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
"time"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-beta-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 Beta"
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)
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.
// 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 Beta");
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);
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.
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\EducationAssignment;
use Microsoft\Graph\Beta\Generated\Models\EducationItemBody;
use Microsoft\Graph\Beta\Generated\Models\BodyType;
use Microsoft\Graph\Beta\Generated\Models\EducationAssignmentPointsGradeType;
use Microsoft\Graph\Beta\Generated\Models\EducationAssignmentClassRecipient;
use Microsoft\Graph\Beta\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 Beta');
$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();
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.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.education_assignment import EducationAssignment
from msgraph_beta.generated.models.education_item_body import EducationItemBody
from msgraph_beta.generated.models.body_type import BodyType
from msgraph_beta.generated.models.education_assignment_points_grade_type import EducationAssignmentPointsGradeType
from msgraph_beta.generated.models.education_assignment_class_recipient import EducationAssignmentClassRecipient
from msgraph_beta.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 Beta",
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)
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.