Пространство имен: microsoft.graph
Важно!
API версии /beta
в Microsoft Graph могут быть изменены. Использование этих API в производственных приложениях не поддерживается. Чтобы определить, доступен ли API в версии 1.0, используйте селектор версий.
Добавление участника educationUser в класс educationClass.
Этот API доступен в следующих национальных облачных развертываниях.
Глобальная служба |
Правительство США L4 |
Правительство США L5 (DOD) |
Китай управляется 21Vianet |
✅ |
❌ |
❌ |
❌ |
Разрешения
Выберите разрешение или разрешения, помеченные как наименее привилегированные для этого API. Используйте более привилегированное разрешение или разрешения только в том случае, если это требуется приложению. Дополнительные сведения о делегированных разрешениях и разрешениях приложений см. в разделе Типы разрешений. Дополнительные сведения об этих разрешениях см. в справочнике по разрешениям.
Тип разрешения |
Разрешения с наименьшими привилегиями |
Более высокие привилегированные разрешения |
Делегированные (рабочая или учебная учетная запись) |
Не поддерживается. |
Не поддерживается. |
Делегированные (личная учетная запись Майкрософт) |
Не поддерживается. |
Не поддерживается. |
Для приложений |
EduRoster.ReadWrite.All |
Member.Read.Hidden |
HTTP-запрос
POST /education/classes/{id}/members/$ref
Тело запроса
В теле запроса предоставьте описание объекта educationUser в формате JSON.
Отклик
При успешном выполнении этот метод возвратит код отклика 204 No Content
и объект educationClass в теле отклика.
Пример
Запрос
Ниже показан пример запроса.
POST https://graph.microsoft.com/beta/education/classes/11011/members/$ref
Content-type: application/json
{
"@odata.id":"https://graph.microsoft.com/beta/education/users/13015"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new ReferenceCreate
{
OdataId = "https://graph.microsoft.com/beta/education/users/13015",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
await graphClient.Education.Classes["{educationClass-id}"].Members.Ref.PostAsync(requestBody);
mgc-beta education classes members ref post --education-class-id {educationClass-id} --body '{\
"@odata.id":"https://graph.microsoft.com/beta/education/users/13015"\
}\
'
// 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.NewReferenceCreate()
odataId := "https://graph.microsoft.com/beta/education/users/13015"
requestBody.SetOdataId(&odataId)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
graphClient.Education().Classes().ByEducationClassId("educationClass-id").Members().Ref().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.beta.models.ReferenceCreate referenceCreate = new com.microsoft.graph.beta.models.ReferenceCreate();
referenceCreate.setOdataId("https://graph.microsoft.com/beta/education/users/13015");
graphClient.education().classes().byEducationClassId("{educationClass-id}").members().ref().post(referenceCreate);
const options = {
authProvider,
};
const client = Client.init(options);
const educationUser = {
'@odata.id':'https://graph.microsoft.com/beta/education/users/13015'
};
await client.api('/education/classes/11011/members/$ref')
.version('beta')
.post(educationUser);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\ReferenceCreate;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new ReferenceCreate();
$requestBody->setOdataId('https://graph.microsoft.com/beta/education/users/13015');
$graphServiceClient->education()->classes()->byEducationClassId('educationClass-id')->members()->ref()->post($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Education
$params = @{
"@odata.id" = "https://graph.microsoft.com/beta/education/users/13015"
}
New-MgBetaEducationClassMemberByRef -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.reference_create import ReferenceCreate
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = ReferenceCreate(
odata_id = "https://graph.microsoft.com/beta/education/users/13015",
)
await graph_client.education.classes.by_education_class_id('educationClass-id').members.ref.post(request_body)
Отклик
Ниже приводится пример отклика.
HTTP/1.1 204 No Content