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.
Permission type
Least privileged permissions
Higher privileged permissions
Delegated (work or school account)
Not supported.
Not supported.
Delegated (personal Microsoft account)
Not supported.
Not supported.
Application
EduRoster.ReadWrite.All
Not available.
HTTP request
POST /education/schools/{id}/users/$ref
Request headers
Header
Value
Authorization
Bearer {token}. Required.
Content-Type
application/json
Request body
In the request body, supply a JSON representation of an educationUser object.
Response
If successful, this method returns a 204 No Content response code and an educationClass object in the response body.
POST https://graph.microsoft.com/v1.0/education/schools/{id}/users/$ref
Content-type: application/json
{
"@odata.id":"https://graph.microsoft.com/v1.0/education/users/14008"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new ReferenceCreate
{
OdataId = "https://graph.microsoft.com/v1.0/education/users/14008",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
await graphClient.Education.Schools["{educationSchool-id}"].Users.Ref.PostAsync(requestBody);
// THE CLI IS IN PREVIEW. NON-PRODUCTION USE ONLY
mgc education schools users ref post --education-school-id {educationSchool-id} --body '{\
"@odata.id":"https://graph.microsoft.com/v1.0/education/users/14008"\
}\
'
<?php
// THIS SNIPPET IS A PREVIEW VERSION OF THE SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new ReferenceCreate();
$requestBody->setOdataId('https://graph.microsoft.com/v1.0/education/users/14008');
$graphServiceClient->education()->schools()->byEducationSchoolId('educationSchool-id')->users()->ref()->post($requestBody)->wait();
# THE PYTHON SDK IS IN PREVIEW. FOR NON-PRODUCTION USE ONLY
graph_client = GraphServiceClient(credentials, scopes)
request_body = ReferenceCreate(
odata_id = "https://graph.microsoft.com/v1.0/education/users/14008",
)
await graph_client.education.schools.by_education_school_id('educationSchool-id').users.ref.post(request_body)