Mettre à jour educationAssignmentSettings
Article 03/15/2024
12 contributeurs
Commentaires
Dans cet article
Espace de noms: microsoft.graph
Importante
Les API sous la version /beta
dans Microsoft Graph sont susceptibles d’être modifiées. L’utilisation de ces API dans des applications de production n’est pas prise en charge. Pour déterminer si une API est disponible dans v1.0, utilisez le sélecteur Version .
Mettez à jour les propriétés d’un objet educationAssignmentSettings . Seuls les enseignants peuvent mettre à jour ces paramètres.
Cette API est disponible dans les déploiements de cloud national suivants.
Service global
Gouvernement des États-Unis L4
Us Government L5 (DOD)
Chine gérée par 21Vianet
✅
❌
❌
❌
Autorisations
Choisissez l’autorisation ou les autorisations marquées comme moins privilégiées pour cette API. Utilisez une autorisation ou des autorisations privilégiées plus élevées uniquement si votre application en a besoin . Pour plus d’informations sur les autorisations déléguées et d’application, consultez Types d’autorisations . Pour en savoir plus sur ces autorisations, consultez les informations de référence sur les autorisations .
Type d’autorisation
Autorisations avec privilèges minimum
Autorisations privilégiées plus élevées
Déléguée (compte professionnel ou scolaire)
EduAssignments.ReadWriteBasic
EduAssignments.ReadWrite
Déléguée (compte Microsoft personnel)
Non prise en charge.
Non prise en charge.
Application
Non prise en charge.
Non prise en charge.
Requête HTTP
PATCH /education/classes/{id}/assignmentSettings
Corps de la demande
Dans le corps de la demande, fournissez une représentation JSON de l’objet educationAssignmentSettings .
Le tableau suivant indique les propriétés requises lorsque vous mettez à jour educationAssignmentSettings .
Propriété
Type
Description
submissionAnimationDisabled
Valeur booléenne
Indique s’il faut afficher l’animation de célébration du retour. La valeur indique d’ignorer true
l’animation. La valeur par défaut est false
.
Réponse
Si elle réussit, cette méthode renvoie un 200 OK
code de réponse et un objet educationAssignmentSettings mis à jour dans le corps de la réponse.
Exemples
Exemple 1 : Mettre à jour submissionAnimationDisabled
Demande
L’exemple suivant illustre une demande.
PATCH https://graph.microsoft.com/beta/education/classes/{id}/assignmentSettings
Content-Type: application/json
{
"submissionAnimationDisabled": true
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new EducationAssignmentSettings
{
SubmissionAnimationDisabled = 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}"].AssignmentSettings.PatchAsync(requestBody);
mgc-beta education classes assignment-settings patch --education-class-id {educationClass-id} --body '{\
"submissionAnimationDisabled": true\
}\
'
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewEducationAssignmentSettings()
submissionAnimationDisabled := true
requestBody.SetSubmissionAnimationDisabled(&submissionAnimationDisabled)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
assignmentSettings, err := graphClient.Education().Classes().ByEducationClassId("educationClass-id").AssignmentSettings().Patch(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
EducationAssignmentSettings educationAssignmentSettings = new EducationAssignmentSettings();
educationAssignmentSettings.setSubmissionAnimationDisabled(true);
EducationAssignmentSettings result = graphClient.education().classes().byEducationClassId("{educationClass-id}").assignmentSettings().patch(educationAssignmentSettings);
const options = {
authProvider,
};
const client = Client.init(options);
const educationAssignmentSettings = {
submissionAnimationDisabled: true
};
await client.api('/education/classes/{id}/assignmentSettings')
.version('beta')
.update(educationAssignmentSettings);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\EducationAssignmentSettings;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new EducationAssignmentSettings();
$requestBody->setSubmissionAnimationDisabled(true);
$result = $graphServiceClient->education()->classes()->byEducationClassId('educationClass-id')->assignmentSettings()->patch($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Education
$params = @{
submissionAnimationDisabled = $true
}
Update-MgBetaEducationClassAssignmentSetting -EducationClassId $educationClassId -BodyParameter $params
# 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_settings import EducationAssignmentSettings
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = EducationAssignmentSettings(
submission_animation_disabled = True,
)
result = await graph_client.education.classes.by_education_class_id('educationClass-id').assignment_settings.patch(request_body)
Réponse
L’exemple suivant illustre la réponse.
Remarque : l’objet de réponse affiché ci-après peut être raccourci pour plus de lisibilité.
HTTP/1.1 200 OK
Content-Type: application/json
{
"submissionAnimationDisabled": true
}
Exemple 2 : Créer des catégories de notation
Demande
L’exemple suivant illustre une demande.
PATCH https://graph.microsoft.com/beta/education/classes/37d99af7-cfc5-4e3b-8566-f7d40e4a2070/assignmentSettings
Content-type: application/json
{
"gradingCategories": [
{
"displayName": "Lab",
"percentageWeight": 10
},
{
"displayName": "Homework",
"percentageWeight": 80
},
{
"displayName": "Test",
"percentageWeight": 10
}
]
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new EducationAssignmentSettings
{
GradingCategories = new List<EducationGradingCategory>
{
new EducationGradingCategory
{
DisplayName = "Lab",
PercentageWeight = 10,
},
new EducationGradingCategory
{
DisplayName = "Homework",
PercentageWeight = 80,
},
new EducationGradingCategory
{
DisplayName = "Test",
PercentageWeight = 10,
},
},
};
// 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}"].AssignmentSettings.PatchAsync(requestBody);
mgc-beta education classes assignment-settings patch --education-class-id {educationClass-id} --body '{\
"gradingCategories": [\
{\
"displayName": "Lab",\
"percentageWeight": 10\
},\
{\
"displayName": "Homework",\
"percentageWeight": 80\
},\
{\
"displayName": "Test",\
"percentageWeight": 10\
}\
]\
}\
'
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewEducationAssignmentSettings()
educationGradingCategory := graphmodels.NewEducationGradingCategory()
displayName := "Lab"
educationGradingCategory.SetDisplayName(&displayName)
percentageWeight := int32(10)
educationGradingCategory.SetPercentageWeight(&percentageWeight)
educationGradingCategory1 := graphmodels.NewEducationGradingCategory()
displayName := "Homework"
educationGradingCategory1.SetDisplayName(&displayName)
percentageWeight := int32(80)
educationGradingCategory1.SetPercentageWeight(&percentageWeight)
educationGradingCategory2 := graphmodels.NewEducationGradingCategory()
displayName := "Test"
educationGradingCategory2.SetDisplayName(&displayName)
percentageWeight := int32(10)
educationGradingCategory2.SetPercentageWeight(&percentageWeight)
gradingCategories := []graphmodels.EducationGradingCategoryable {
educationGradingCategory,
educationGradingCategory1,
educationGradingCategory2,
}
requestBody.SetGradingCategories(gradingCategories)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
assignmentSettings, err := graphClient.Education().Classes().ByEducationClassId("educationClass-id").AssignmentSettings().Patch(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
EducationAssignmentSettings educationAssignmentSettings = new EducationAssignmentSettings();
LinkedList<EducationGradingCategory> gradingCategories = new LinkedList<EducationGradingCategory>();
EducationGradingCategory educationGradingCategory = new EducationGradingCategory();
educationGradingCategory.setDisplayName("Lab");
educationGradingCategory.setPercentageWeight(10);
gradingCategories.add(educationGradingCategory);
EducationGradingCategory educationGradingCategory1 = new EducationGradingCategory();
educationGradingCategory1.setDisplayName("Homework");
educationGradingCategory1.setPercentageWeight(80);
gradingCategories.add(educationGradingCategory1);
EducationGradingCategory educationGradingCategory2 = new EducationGradingCategory();
educationGradingCategory2.setDisplayName("Test");
educationGradingCategory2.setPercentageWeight(10);
gradingCategories.add(educationGradingCategory2);
educationAssignmentSettings.setGradingCategories(gradingCategories);
EducationAssignmentSettings result = graphClient.education().classes().byEducationClassId("{educationClass-id}").assignmentSettings().patch(educationAssignmentSettings);
const options = {
authProvider,
};
const client = Client.init(options);
const educationAssignmentSettings = {
gradingCategories: [
{
displayName: 'Lab',
percentageWeight: 10
},
{
displayName: 'Homework',
percentageWeight: 80
},
{
displayName: 'Test',
percentageWeight: 10
}
]
};
await client.api('/education/classes/37d99af7-cfc5-4e3b-8566-f7d40e4a2070/assignmentSettings')
.version('beta')
.update(educationAssignmentSettings);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\EducationAssignmentSettings;
use Microsoft\Graph\Beta\Generated\Models\EducationGradingCategory;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new EducationAssignmentSettings();
$gradingCategoriesEducationGradingCategory1 = new EducationGradingCategory();
$gradingCategoriesEducationGradingCategory1->setDisplayName('Lab');
$gradingCategoriesEducationGradingCategory1->setPercentageWeight(10);
$gradingCategoriesArray []= $gradingCategoriesEducationGradingCategory1;
$gradingCategoriesEducationGradingCategory2 = new EducationGradingCategory();
$gradingCategoriesEducationGradingCategory2->setDisplayName('Homework');
$gradingCategoriesEducationGradingCategory2->setPercentageWeight(80);
$gradingCategoriesArray []= $gradingCategoriesEducationGradingCategory2;
$gradingCategoriesEducationGradingCategory3 = new EducationGradingCategory();
$gradingCategoriesEducationGradingCategory3->setDisplayName('Test');
$gradingCategoriesEducationGradingCategory3->setPercentageWeight(10);
$gradingCategoriesArray []= $gradingCategoriesEducationGradingCategory3;
$requestBody->setGradingCategories($gradingCategoriesArray);
$result = $graphServiceClient->education()->classes()->byEducationClassId('educationClass-id')->assignmentSettings()->patch($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Education
$params = @{
gradingCategories = @(
@{
displayName = "Lab"
percentageWeight = 10
}
@{
displayName = "Homework"
percentageWeight = 80
}
@{
displayName = "Test"
percentageWeight = 10
}
)
}
Update-MgBetaEducationClassAssignmentSetting -EducationClassId $educationClassId -BodyParameter $params
# 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_settings import EducationAssignmentSettings
from msgraph_beta.generated.models.education_grading_category import EducationGradingCategory
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = EducationAssignmentSettings(
grading_categories = [
EducationGradingCategory(
display_name = "Lab",
percentage_weight = 10,
),
EducationGradingCategory(
display_name = "Homework",
percentage_weight = 80,
),
EducationGradingCategory(
display_name = "Test",
percentage_weight = 10,
),
],
)
result = await graph_client.education.classes.by_education_class_id('educationClass-id').assignment_settings.patch(request_body)
Réponse
L’exemple suivant illustre la réponse.
Remarque : l’objet de réponse affiché ci-après peut être raccourci pour plus de lisibilité.
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/beta/education/classes('37d99af7-cfc5-4e3b-8566-f7d40e4a2070')/assignmentSettings/$entity",
"submissionAnimationDisabled": false,
"gradingCategories@odata.context": "https://graph.microsoft.com/beta/$metadata#education/classes('37d99af7-cfc5-4e3b-8566-f7d40e4a2070')/assignmentSettings/gradingCategories",
"gradingCategories": [
{
"id": "8bfb6d7f-8634-4f3b-9b6a-b6b6ff663f01",
"displayName": "Lab",
"percentageWeight": 10
},
{
"id": "6fd19981-588f-495c-91a8-712a645c95b7",
"displayName": "Homework",
"percentageWeight": 80
},
{
"id": "54f637a5-2cef-4e48-a88e-028854ca8089",
"displayName": "Test",
"percentageWeight": 10
}
]
}
Exemple 3 : Charge utile Delta pour supprimer, modifier et ajouter des catégories de notation
Demande
L’exemple suivant illustre une demande.
PATCH https://graph.microsoft.com/beta/education/classes/37d99af7-cfc5-4e3b-8566-f7d40e4a2070/assignmentSettings
Content-type: application/json
{
"gradingCategories@delta": [
{
// Change this grading category's name
"id": "fb859cd3-943b-4cd6-9bbe-fe1c39eace0e",
"displayName": "Lab Test"
},
{
// Delete this grading category
"@odata.context": "https://graph.microsoft.com/beta/$metadata#gradingCategories/$deletedEntity",
"id": "e2a86277-24f9-4f29-8196-8c83fc69d00d",
"reason": "deleted"
},
{
// Add a new grading category
"displayName": "Lab Practice",
"percentageWeight": 30
},
{
"displayName": "Lab Theory",
"percentageWeight": 10
}
]
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
using Microsoft.Kiota.Abstractions.Serialization;
var requestBody = new EducationAssignmentSettings
{
AdditionalData = new Dictionary<string, object>
{
{
"gradingCategories@delta" , new List<object>
{
new UntypedObject(new Dictionary<string, UntypedNode>
{
{
"id", new UntypedString("03bd9196-ce2e-41bd-902f-df9ae02de4db")
},
{
"displayName", new UntypedString("Lab Updated")
},
}),
new UntypedObject(new Dictionary<string, UntypedNode>
{
{
"@odata.context", new UntypedString("https://graph.microsoft.com/beta/$metadata#gradingCategories/$deletedEntity")
},
{
"id", new UntypedString("109e5d73-3ef7-42a5-88d8-7e30cdb85f06")
},
{
"reason", new UntypedString("deleted")
},
}),
new UntypedObject(new Dictionary<string, UntypedNode>
{
{
"displayName", new UntypedString("New Homework")
},
{
"percentageWeight", new UntypedString("50")
},
}),
}
},
},
};
// 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}"].AssignmentSettings.PatchAsync(requestBody);
mgc education classes assignment-settings patch --education-class-id {educationClass-id} --body '{\
"gradingCategories@delta": [\
{\
// Change this grading category's name\
"id": "03bd9196-ce2e-41bd-902f-df9ae02de4db",\
"displayName": "Lab Updated"\
},\
{\
// Delete this grading category \
"@odata.context": "https://graph.microsoft.com/beta/$metadata#gradingCategories/$deletedEntity",\
"id": "109e5d73-3ef7-42a5-88d8-7e30cdb85f06",\
"reason": "deleted"\
},\
{\
// Add a new grading category \
"displayName": "New Homework",\
"percentageWeight": 50\
}\
]\
}\
'
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
EducationAssignmentSettings educationAssignmentSettings = new EducationAssignmentSettings();
HashMap<String, Object> additionalData = new HashMap<String, Object>();
LinkedList<Object> gradingCategoriesDelta = new LinkedList<Object>();
property = new ();
property.setId("03bd9196-ce2e-41bd-902f-df9ae02de4db");
property.setDisplayName("Lab Updated");
gradingCategoriesDelta.add(property);
property1 = new ();
property1.setOdataContext("https://graph.microsoft.com/beta/$metadata#gradingCategories/$deletedEntity");
property1.setId("109e5d73-3ef7-42a5-88d8-7e30cdb85f06");
property1.setReason("deleted");
gradingCategoriesDelta.add(property1);
property2 = new ();
property2.setDisplayName("New Homework");
property2.setPercentageWeight(50);
gradingCategoriesDelta.add(property2);
additionalData.put("gradingCategories@delta", gradingCategoriesDelta);
educationAssignmentSettings.setAdditionalData(additionalData);
EducationAssignmentSettings result = graphClient.education().classes().byEducationClassId("{educationClass-id}").assignmentSettings().patch(educationAssignmentSettings);
const options = {
authProvider,
};
const client = Client.init(options);
const educationAssignmentSettings = {
'gradingCategories@delta': [
{
// Change this grading category\'s name
id: '03bd9196-ce2e-41bd-902f-df9ae02de4db',
displayName: 'Lab Updated'
},
{
// Delete this grading category
'@odata.context': 'https://graph.microsoft.com/beta/$metadata#gradingCategories/$deletedEntity',
id: '109e5d73-3ef7-42a5-88d8-7e30cdb85f06',
reason: 'deleted'
},
{
// Add a new grading category
displayName: 'New Homework',
percentageWeight: 50
}
]
};
await client.api('/education/classes/37d99af7-cfc5-4e3b-8566-f7d40e4a2070/assignmentSettings')
.update(educationAssignmentSettings);
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\EducationAssignmentSettings;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new EducationAssignmentSettings();
$additionalData = [
'gradingCategories@delta' => [
[
'id' => '03bd9196-ce2e-41bd-902f-df9ae02de4db',
'displayName' => 'Lab Updated',
],
[
'@odata.context' => 'https://graph.microsoft.com/beta/$metadata#gradingCategories/$deletedEntity',
'id' => '109e5d73-3ef7-42a5-88d8-7e30cdb85f06',
'reason' => 'deleted',
],
[
'displayName' => 'New Homework',
'percentageWeight' => 50,
],
],
];
$requestBody->setAdditionalData($additionalData);
$result = $graphServiceClient->education()->classes()->byEducationClassId('educationClass-id')->assignmentSettings()->patch($requestBody)->wait();
Import-Module Microsoft.Graph.Education
$params = @{
"gradingCategories@delta" = @(
@{
id = "03bd9196-ce2e-41bd-902f-df9ae02de4db"
displayName = "Lab Updated"
}
@{
"@odata.context" = "https://graph.microsoft.com/beta/$metadata#gradingCategories/$deletedEntity"
id = "109e5d73-3ef7-42a5-88d8-7e30cdb85f06"
reason = "deleted"
}
@{
displayName = "New Homework"
percentageWeight =
}
)
}
Update-MgEducationClassAssignmentSetting -EducationClassId $educationClassId -BodyParameter $params
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.education_assignment_settings import EducationAssignmentSettings
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = EducationAssignmentSettings(
additional_data = {
"grading_categories@delta" : [
{
"id" : "03bd9196-ce2e-41bd-902f-df9ae02de4db",
"display_name" : "Lab Updated",
},
{
"@odata_context" : "https://graph.microsoft.com/beta/$metadata#gradingCategories/$deletedEntity",
"id" : "109e5d73-3ef7-42a5-88d8-7e30cdb85f06",
"reason" : "deleted",
},
{
"display_name" : "New Homework",
"percentage_weight" : 50,
},
],
}
)
result = await graph_client.education.classes.by_education_class_id('educationClass-id').assignment_settings.patch(request_body)
Réponse
L’exemple suivant illustre la réponse.
Remarque : l’objet de réponse affiché ci-après peut être raccourci pour plus de lisibilité.
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#education/classes('37d99af7-cfc5-4e3b-8566-f7d40e4a2070')/assignmentSettings/$entity",
"submissionAnimationDisabled": false,
"gradingCategories@odata.context": "https://graph.microsoft.com/beta/$metadata#education/classes('37d99af7-cfc5-4e3b-8566-f7d40e4a2070')/assignmentSettings/gradingCategories",
"gradingCategories": [
{
"id": "fb4a4009-3cc4-4dea-9991-e0a0763659e3",
"displayName": "Homework",
"percentageWeight": 30
},
{
"id": "fb859cd3-943b-4cd6-9bbe-fe1c39eace0e",
"displayName": "Lab Test",
"percentageWeight": 30
},
{
"id": "d47d7a3f-44a1-47e1-8aec-68b028f64b2e",
"displayName": "Lab Practice",
"percentageWeight": 30
},
{
"id": "021db844-0f03-4483-929d-1c1dbfd4fcb4",
"displayName": "Lab Theory",
"percentageWeight": 10
}
]
}
Exemple 4 : Créer des schémas de notation
Demande
L’exemple suivant illustre une demande.
PATCH https://graph.microsoft.com/beta/education/classes/37d99af7-cfc5-4e3b-8566-f7d40e4a2070/assignmentSettings
Content-type: application/json
{
"gradingSchemes": [
{
"displayName": "Pass/fail",
"grades": [
{
"displayName": "Pass",
"minPercentage": 60,
"defaultPercentage": 100
},
{
"displayName": "Fail",
"minPercentage": 0,
"defaultPercentage": 0
}
]
},
{
"displayName": "Letters",
"grades": [
{
"displayName": "A",
"minPercentage": 90
},
{
"displayName": "B",
"minPercentage": 80
},
{
"displayName": "C",
"minPercentage": 70
},
{
"displayName": "D",
"minPercentage": 60
},
{
"displayName": "F",
"minPercentage": 0
}
]
}
]
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new EducationAssignmentSettings
{
GradingSchemes = new List<EducationGradingScheme>
{
new EducationGradingScheme
{
DisplayName = "Pass/fail",
Grades = new List<EducationGradingSchemeGrade>
{
new EducationGradingSchemeGrade
{
DisplayName = "Pass",
MinPercentage = 60f,
DefaultPercentage = 100f,
},
new EducationGradingSchemeGrade
{
DisplayName = "Fail",
MinPercentage = 0f,
DefaultPercentage = 0f,
},
},
},
new EducationGradingScheme
{
DisplayName = "Letters",
Grades = new List<EducationGradingSchemeGrade>
{
new EducationGradingSchemeGrade
{
DisplayName = "A",
MinPercentage = 90f,
},
new EducationGradingSchemeGrade
{
DisplayName = "B",
MinPercentage = 80f,
},
new EducationGradingSchemeGrade
{
DisplayName = "C",
MinPercentage = 70f,
},
new EducationGradingSchemeGrade
{
DisplayName = "D",
MinPercentage = 60f,
},
new EducationGradingSchemeGrade
{
DisplayName = "F",
MinPercentage = 0f,
},
},
},
},
};
// 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}"].AssignmentSettings.PatchAsync(requestBody);
mgc-beta education classes assignment-settings patch --education-class-id {educationClass-id} --body '{\
"gradingSchemes": [\
{\
"displayName": "Pass/fail",\
"grades": [\
{\
"displayName": "Pass",\
"minPercentage": 60,\
"defaultPercentage": 100\
},\
{\
"displayName": "Fail",\
"minPercentage": 0,\
"defaultPercentage": 0\
}\
]\
},\
{\
"displayName": "Letters",\
"grades": [\
{\
"displayName": "A",\
"minPercentage": 90\
},\
{\
"displayName": "B",\
"minPercentage": 80\
},\
{\
"displayName": "C",\
"minPercentage": 70\
},\
{\
"displayName": "D",\
"minPercentage": 60\
},\
{\
"displayName": "F",\
"minPercentage": 0\
}\
]\
}\
]\
}\
'
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewEducationAssignmentSettings()
educationGradingScheme := graphmodels.NewEducationGradingScheme()
displayName := "Pass/fail"
educationGradingScheme.SetDisplayName(&displayName)
educationGradingSchemeGrade := graphmodels.NewEducationGradingSchemeGrade()
displayName := "Pass"
educationGradingSchemeGrade.SetDisplayName(&displayName)
minPercentage := float32(60)
educationGradingSchemeGrade.SetMinPercentage(&minPercentage)
defaultPercentage := float32(100)
educationGradingSchemeGrade.SetDefaultPercentage(&defaultPercentage)
educationGradingSchemeGrade1 := graphmodels.NewEducationGradingSchemeGrade()
displayName := "Fail"
educationGradingSchemeGrade1.SetDisplayName(&displayName)
minPercentage := float32(0)
educationGradingSchemeGrade1.SetMinPercentage(&minPercentage)
defaultPercentage := float32(0)
educationGradingSchemeGrade1.SetDefaultPercentage(&defaultPercentage)
grades := []graphmodels.EducationGradingSchemeGradeable {
educationGradingSchemeGrade,
educationGradingSchemeGrade1,
}
educationGradingScheme.SetGrades(grades)
educationGradingScheme1 := graphmodels.NewEducationGradingScheme()
displayName := "Letters"
educationGradingScheme1.SetDisplayName(&displayName)
educationGradingSchemeGrade := graphmodels.NewEducationGradingSchemeGrade()
displayName := "A"
educationGradingSchemeGrade.SetDisplayName(&displayName)
minPercentage := float32(90)
educationGradingSchemeGrade.SetMinPercentage(&minPercentage)
educationGradingSchemeGrade1 := graphmodels.NewEducationGradingSchemeGrade()
displayName := "B"
educationGradingSchemeGrade1.SetDisplayName(&displayName)
minPercentage := float32(80)
educationGradingSchemeGrade1.SetMinPercentage(&minPercentage)
educationGradingSchemeGrade2 := graphmodels.NewEducationGradingSchemeGrade()
displayName := "C"
educationGradingSchemeGrade2.SetDisplayName(&displayName)
minPercentage := float32(70)
educationGradingSchemeGrade2.SetMinPercentage(&minPercentage)
educationGradingSchemeGrade3 := graphmodels.NewEducationGradingSchemeGrade()
displayName := "D"
educationGradingSchemeGrade3.SetDisplayName(&displayName)
minPercentage := float32(60)
educationGradingSchemeGrade3.SetMinPercentage(&minPercentage)
educationGradingSchemeGrade4 := graphmodels.NewEducationGradingSchemeGrade()
displayName := "F"
educationGradingSchemeGrade4.SetDisplayName(&displayName)
minPercentage := float32(0)
educationGradingSchemeGrade4.SetMinPercentage(&minPercentage)
grades := []graphmodels.EducationGradingSchemeGradeable {
educationGradingSchemeGrade,
educationGradingSchemeGrade1,
educationGradingSchemeGrade2,
educationGradingSchemeGrade3,
educationGradingSchemeGrade4,
}
educationGradingScheme1.SetGrades(grades)
gradingSchemes := []graphmodels.EducationGradingSchemeable {
educationGradingScheme,
educationGradingScheme1,
}
requestBody.SetGradingSchemes(gradingSchemes)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
assignmentSettings, err := graphClient.Education().Classes().ByEducationClassId("educationClass-id").AssignmentSettings().Patch(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
EducationAssignmentSettings educationAssignmentSettings = new EducationAssignmentSettings();
LinkedList<EducationGradingScheme> gradingSchemes = new LinkedList<EducationGradingScheme>();
EducationGradingScheme educationGradingScheme = new EducationGradingScheme();
educationGradingScheme.setDisplayName("Pass/fail");
LinkedList<EducationGradingSchemeGrade> grades = new LinkedList<EducationGradingSchemeGrade>();
EducationGradingSchemeGrade educationGradingSchemeGrade = new EducationGradingSchemeGrade();
educationGradingSchemeGrade.setDisplayName("Pass");
educationGradingSchemeGrade.setMinPercentage(60f);
educationGradingSchemeGrade.setDefaultPercentage(100f);
grades.add(educationGradingSchemeGrade);
EducationGradingSchemeGrade educationGradingSchemeGrade1 = new EducationGradingSchemeGrade();
educationGradingSchemeGrade1.setDisplayName("Fail");
educationGradingSchemeGrade1.setMinPercentage(0f);
educationGradingSchemeGrade1.setDefaultPercentage(0f);
grades.add(educationGradingSchemeGrade1);
educationGradingScheme.setGrades(grades);
gradingSchemes.add(educationGradingScheme);
EducationGradingScheme educationGradingScheme1 = new EducationGradingScheme();
educationGradingScheme1.setDisplayName("Letters");
LinkedList<EducationGradingSchemeGrade> grades1 = new LinkedList<EducationGradingSchemeGrade>();
EducationGradingSchemeGrade educationGradingSchemeGrade2 = new EducationGradingSchemeGrade();
educationGradingSchemeGrade2.setDisplayName("A");
educationGradingSchemeGrade2.setMinPercentage(90f);
grades1.add(educationGradingSchemeGrade2);
EducationGradingSchemeGrade educationGradingSchemeGrade3 = new EducationGradingSchemeGrade();
educationGradingSchemeGrade3.setDisplayName("B");
educationGradingSchemeGrade3.setMinPercentage(80f);
grades1.add(educationGradingSchemeGrade3);
EducationGradingSchemeGrade educationGradingSchemeGrade4 = new EducationGradingSchemeGrade();
educationGradingSchemeGrade4.setDisplayName("C");
educationGradingSchemeGrade4.setMinPercentage(70f);
grades1.add(educationGradingSchemeGrade4);
EducationGradingSchemeGrade educationGradingSchemeGrade5 = new EducationGradingSchemeGrade();
educationGradingSchemeGrade5.setDisplayName("D");
educationGradingSchemeGrade5.setMinPercentage(60f);
grades1.add(educationGradingSchemeGrade5);
EducationGradingSchemeGrade educationGradingSchemeGrade6 = new EducationGradingSchemeGrade();
educationGradingSchemeGrade6.setDisplayName("F");
educationGradingSchemeGrade6.setMinPercentage(0f);
grades1.add(educationGradingSchemeGrade6);
educationGradingScheme1.setGrades(grades1);
gradingSchemes.add(educationGradingScheme1);
educationAssignmentSettings.setGradingSchemes(gradingSchemes);
EducationAssignmentSettings result = graphClient.education().classes().byEducationClassId("{educationClass-id}").assignmentSettings().patch(educationAssignmentSettings);
const options = {
authProvider,
};
const client = Client.init(options);
const educationAssignmentSettings = {
gradingSchemes: [
{
displayName: 'Pass/fail',
grades: [
{
displayName: 'Pass',
minPercentage: 60,
defaultPercentage: 100
},
{
displayName: 'Fail',
minPercentage: 0,
defaultPercentage: 0
}
]
},
{
displayName: 'Letters',
grades: [
{
displayName: 'A',
minPercentage: 90
},
{
displayName: 'B',
minPercentage: 80
},
{
displayName: 'C',
minPercentage: 70
},
{
displayName: 'D',
minPercentage: 60
},
{
displayName: 'F',
minPercentage: 0
}
]
}
]
};
await client.api('/education/classes/37d99af7-cfc5-4e3b-8566-f7d40e4a2070/assignmentSettings')
.version('beta')
.update(educationAssignmentSettings);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\EducationAssignmentSettings;
use Microsoft\Graph\Beta\Generated\Models\EducationGradingScheme;
use Microsoft\Graph\Beta\Generated\Models\EducationGradingSchemeGrade;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new EducationAssignmentSettings();
$gradingSchemesEducationGradingScheme1 = new EducationGradingScheme();
$gradingSchemesEducationGradingScheme1->setDisplayName('Pass/fail');
$gradesEducationGradingSchemeGrade1 = new EducationGradingSchemeGrade();
$gradesEducationGradingSchemeGrade1->setDisplayName('Pass');
$gradesEducationGradingSchemeGrade1->setMinPercentage(60);
$gradesEducationGradingSchemeGrade1->setDefaultPercentage(100);
$gradesArray []= $gradesEducationGradingSchemeGrade1;
$gradesEducationGradingSchemeGrade2 = new EducationGradingSchemeGrade();
$gradesEducationGradingSchemeGrade2->setDisplayName('Fail');
$gradesEducationGradingSchemeGrade2->setMinPercentage(0);
$gradesEducationGradingSchemeGrade2->setDefaultPercentage(0);
$gradesArray []= $gradesEducationGradingSchemeGrade2;
$gradingSchemesEducationGradingScheme1->setGrades($gradesArray);
$gradingSchemesArray []= $gradingSchemesEducationGradingScheme1;
$gradingSchemesEducationGradingScheme2 = new EducationGradingScheme();
$gradingSchemesEducationGradingScheme2->setDisplayName('Letters');
$gradesEducationGradingSchemeGrade1 = new EducationGradingSchemeGrade();
$gradesEducationGradingSchemeGrade1->setDisplayName('A');
$gradesEducationGradingSchemeGrade1->setMinPercentage(90);
$gradesArray []= $gradesEducationGradingSchemeGrade1;
$gradesEducationGradingSchemeGrade2 = new EducationGradingSchemeGrade();
$gradesEducationGradingSchemeGrade2->setDisplayName('B');
$gradesEducationGradingSchemeGrade2->setMinPercentage(80);
$gradesArray []= $gradesEducationGradingSchemeGrade2;
$gradesEducationGradingSchemeGrade3 = new EducationGradingSchemeGrade();
$gradesEducationGradingSchemeGrade3->setDisplayName('C');
$gradesEducationGradingSchemeGrade3->setMinPercentage(70);
$gradesArray []= $gradesEducationGradingSchemeGrade3;
$gradesEducationGradingSchemeGrade4 = new EducationGradingSchemeGrade();
$gradesEducationGradingSchemeGrade4->setDisplayName('D');
$gradesEducationGradingSchemeGrade4->setMinPercentage(60);
$gradesArray []= $gradesEducationGradingSchemeGrade4;
$gradesEducationGradingSchemeGrade5 = new EducationGradingSchemeGrade();
$gradesEducationGradingSchemeGrade5->setDisplayName('F');
$gradesEducationGradingSchemeGrade5->setMinPercentage(0);
$gradesArray []= $gradesEducationGradingSchemeGrade5;
$gradingSchemesEducationGradingScheme2->setGrades($gradesArray);
$gradingSchemesArray []= $gradingSchemesEducationGradingScheme2;
$requestBody->setGradingSchemes($gradingSchemesArray);
$result = $graphServiceClient->education()->classes()->byEducationClassId('educationClass-id')->assignmentSettings()->patch($requestBody)->wait();
# 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_settings import EducationAssignmentSettings
from msgraph_beta.generated.models.education_grading_scheme import EducationGradingScheme
from msgraph_beta.generated.models.education_grading_scheme_grade import EducationGradingSchemeGrade
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = EducationAssignmentSettings(
grading_schemes = [
EducationGradingScheme(
display_name = "Pass/fail",
grades = [
EducationGradingSchemeGrade(
display_name = "Pass",
min_percentage = 60,
default_percentage = 100,
),
EducationGradingSchemeGrade(
display_name = "Fail",
min_percentage = 0,
default_percentage = 0,
),
],
),
EducationGradingScheme(
display_name = "Letters",
grades = [
EducationGradingSchemeGrade(
display_name = "A",
min_percentage = 90,
),
EducationGradingSchemeGrade(
display_name = "B",
min_percentage = 80,
),
EducationGradingSchemeGrade(
display_name = "C",
min_percentage = 70,
),
EducationGradingSchemeGrade(
display_name = "D",
min_percentage = 60,
),
EducationGradingSchemeGrade(
display_name = "F",
min_percentage = 0,
),
],
),
],
)
result = await graph_client.education.classes.by_education_class_id('educationClass-id').assignment_settings.patch(request_body)
Réponse
L’exemple suivant illustre la réponse.
Remarque : l’objet de réponse affiché ci-après peut être raccourci pour plus de lisibilité.
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#education/classes('37d99af7-cfc5-4e3b-8566-f7d40e4a2070')/assignmentSettings/$entity",
"@microsoft.graph.tips": "Use $select to choose only the properties your app needs, as this can lead to performance improvements. For example: GET education/classes('<guid>')/assignmentSettings?$select=submissionAnimationDisabled",
"submissionAnimationDisabled": true,
"gradingCategories@odata.context": "https://graph.microsoft.com/beta/$metadata#education/classes('37d99af7-cfc5-4e3b-8566-f7d40e4a2070')/assignmentSettings/gradingCategories",
"gradingCategories": [
{
"id": "21ca44c0-c44b-4fda-8f6a-dd56e86650e9",
"displayName": "Lab",
"percentageWeight": 10
},
{
"id": "f216fee5-870b-42de-b847-c38e810dffb7",
"displayName": "Homework",
"percentageWeight": 80
},
{
"id": "db8f13e7-b71a-4c91-9934-b915f4ac49b7",
"displayName": "Test",
"percentageWeight": 10
}
],
"gradingSchemes@odata.context": "https://graph.microsoft.com/beta/$metadata#education/classes('37d99af7-cfc5-4e3b-8566-f7d40e4a2070')/assignmentSettings/gradingSchemes",
"gradingSchemes": [
{
"id": "69911dea-bc5c-406a-8743-81d06225a3a1",
"displayName": "Points",
"hidePointsDuringGrading": false,
"grades": []
},
{
"id": "696290ba-1925-490e-a5d2-026bad0dbdc1",
"displayName": "New name for Pass/Fail Scheme",
"hidePointsDuringGrading": false,
"grades": [
{
"displayName": "Pass",
"minPercentage": 60,
"defaultPercentage": 100
},
{
"displayName": "Fail",
"minPercentage": 0,
"defaultPercentage": 0
}
]
},
{
"id": "291f9918-b52c-4cf0-b94f-55982a82995f",
"displayName": "Letters",
"hidePointsDuringGrading": false,
"grades": [
{
"displayName": "A",
"minPercentage": 90,
"defaultPercentage": null
},
{
"displayName": "B",
"minPercentage": 80,
"defaultPercentage": null
},
{
"displayName": "C",
"minPercentage": 70,
"defaultPercentage": null
},
{
"displayName": "D",
"minPercentage": 60,
"defaultPercentage": null
},
{
"displayName": "F",
"minPercentage": 0,
"defaultPercentage": null
}
]
}
]
}