Espacio de nombres: microsoft.graph
Cree un nuevo objeto educationSchool .
Esta API está disponible en las siguientes implementaciones nacionales de nube.
Servicio global |
Gobierno de EE. UU. L4 |
Us Government L5 (DOD) |
China operada por 21Vianet |
✅ |
❌ |
❌ |
❌ |
Permissions
Elija el permiso o los permisos marcados como con privilegios mínimos para esta API. Use un permiso o permisos con privilegios superiores solo si la aplicación lo requiere. Para obtener más información sobre los permisos delegados y de aplicación, consulte Tipos de permisos. Para obtener más información sobre estos permisos, consulte la referencia de permisos.
Tipo de permiso |
Permisos con privilegios mínimos |
Permisos con privilegios más altos |
Delegado (cuenta profesional o educativa) |
No admitida. |
No admitida. |
Delegado (cuenta personal de Microsoft) |
No admitida. |
No admitida. |
Aplicación |
EduRoster.ReadWrite.All |
No disponible. |
Solicitud HTTP
POST /education/schools
Nombre |
Descripción |
Authorization |
{token} de portador. Obligatorio. Obtenga más información sobre la autenticación y la autorización. |
Content-Type |
application/json. Obligatorio. |
Cuerpo de la solicitud
En el cuerpo de la solicitud, proporcione una representación JSON del objeto educationSchool .
En la tabla siguiente se enumeran las propiedades necesarias al crear educationSchool.
Propiedad |
Tipo |
Descripción |
displayName |
String |
Nombre para mostrar del centro educativo. Heredado de educationOrganization. |
description |
String |
Descripción del centro educativo. Heredado de educationOrganization. |
externalSource |
educationExternalSource |
Origen desde el que se creó esta organización. Heredado de educationOrganization. Los valores posibles son: sis , 'manual. |
externalSourceDetail |
Cadena |
Nombre del origen externo desde el que se generaron estos recursos. |
principalEmail |
String |
Dirección de correo electrónico del director. |
principalName |
String |
Nombre del director. |
externalPrincipalId |
String |
Identificador del director en el sistema de sincronización. |
highestGrade |
String |
Curso más alto que se imparte. |
lowestGrade |
String |
Curso más bajo que se imparte. |
schoolNumber |
String |
Número del centro educativo |
externalId |
String |
Identificador del centro educativo en el sistema de sincronización. |
phone |
String |
Número de teléfono del centro educativo. |
fax |
String |
Número de fax del centro educativo. |
createdBy |
identitySet |
Entidad que ha creado el centro educativo. |
address |
physicalAddress |
Dirección del centro educativo. |
Respuesta
Si se ejecuta correctamente, este método devuelve un código de respuesta 201 Created
y un objeto educationSchool en el cuerpo de la respuesta.
Ejemplos
Solicitud
POST https://graph.microsoft.com/v1.0/education/schools
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.educationSchool",
"displayName": "String",
"description": "String",
"externalSource": "String",
"externalSourceDetail": "String",
"principalEmail": "String",
"principalName": "String",
"externalPrincipalId": "String",
"lowestGrade": "String",
"highestGrade": "String",
"schoolNumber": "String",
"externalId": "String",
"phone": "String",
"fax": "String",
"createdBy": {
"@odata.type": "microsoft.graph.identitySet"
},
"address": {
"@odata.type": "microsoft.graph.physicalAddress"
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new EducationSchool
{
OdataType = "#microsoft.graph.educationSchool",
DisplayName = "String",
Description = "String",
ExternalSource = EducationExternalSource.Sis,
ExternalSourceDetail = "String",
PrincipalEmail = "String",
PrincipalName = "String",
ExternalPrincipalId = "String",
LowestGrade = "String",
HighestGrade = "String",
SchoolNumber = "String",
ExternalId = "String",
Phone = "String",
Fax = "String",
CreatedBy = new IdentitySet
{
OdataType = "microsoft.graph.identitySet",
},
Address = new PhysicalAddress
{
OdataType = "microsoft.graph.physicalAddress",
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Education.Schools.PostAsync(requestBody);
Para obtener más información sobre cómo agregar el SDK al proyecto y crear una instancia de authProvider, consulte la documentación del SDK.
mgc education schools create --body '{\
"@odata.type": "#microsoft.graph.educationSchool",\
"displayName": "String",\
"description": "String",\
"externalSource": "String",\
"externalSourceDetail": "String",\
"principalEmail": "String",\
"principalName": "String",\
"externalPrincipalId": "String",\
"lowestGrade": "String",\
"highestGrade": "String",\
"schoolNumber": "String",\
"externalId": "String",\
"phone": "String",\
"fax": "String",\
"createdBy": {\
"@odata.type": "microsoft.graph.identitySet"\
},\
"address": {\
"@odata.type": "microsoft.graph.physicalAddress"\
}\
}\
'
Para obtener más información sobre cómo agregar el SDK al proyecto y crear una instancia de authProvider, consulte la documentación del SDK.
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewEducationSchool()
displayName := "String"
requestBody.SetDisplayName(&displayName)
description := "String"
requestBody.SetDescription(&description)
externalSource := graphmodels.STRING_EDUCATIONEXTERNALSOURCE
requestBody.SetExternalSource(&externalSource)
externalSourceDetail := "String"
requestBody.SetExternalSourceDetail(&externalSourceDetail)
principalEmail := "String"
requestBody.SetPrincipalEmail(&principalEmail)
principalName := "String"
requestBody.SetPrincipalName(&principalName)
externalPrincipalId := "String"
requestBody.SetExternalPrincipalId(&externalPrincipalId)
lowestGrade := "String"
requestBody.SetLowestGrade(&lowestGrade)
highestGrade := "String"
requestBody.SetHighestGrade(&highestGrade)
schoolNumber := "String"
requestBody.SetSchoolNumber(&schoolNumber)
externalId := "String"
requestBody.SetExternalId(&externalId)
phone := "String"
requestBody.SetPhone(&phone)
fax := "String"
requestBody.SetFax(&fax)
createdBy := graphmodels.NewIdentitySet()
requestBody.SetCreatedBy(createdBy)
address := graphmodels.NewPhysicalAddress()
requestBody.SetAddress(address)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
schools, err := graphClient.Education().Schools().Post(context.Background(), requestBody, nil)
Para obtener más información sobre cómo agregar el SDK al proyecto y crear una instancia de authProvider, consulte la documentación del SDK.
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
EducationSchool educationSchool = new EducationSchool();
educationSchool.setOdataType("#microsoft.graph.educationSchool");
educationSchool.setDisplayName("String");
educationSchool.setDescription("String");
educationSchool.setExternalSource(EducationExternalSource.Sis);
educationSchool.setExternalSourceDetail("String");
educationSchool.setPrincipalEmail("String");
educationSchool.setPrincipalName("String");
educationSchool.setExternalPrincipalId("String");
educationSchool.setLowestGrade("String");
educationSchool.setHighestGrade("String");
educationSchool.setSchoolNumber("String");
educationSchool.setExternalId("String");
educationSchool.setPhone("String");
educationSchool.setFax("String");
IdentitySet createdBy = new IdentitySet();
createdBy.setOdataType("microsoft.graph.identitySet");
educationSchool.setCreatedBy(createdBy);
PhysicalAddress address = new PhysicalAddress();
address.setOdataType("microsoft.graph.physicalAddress");
educationSchool.setAddress(address);
EducationSchool result = graphClient.education().schools().post(educationSchool);
Para obtener más información sobre cómo agregar el SDK al proyecto y crear una instancia de authProvider, consulte la documentación del SDK.
const options = {
authProvider,
};
const client = Client.init(options);
const educationSchool = {
'@odata.type': '#microsoft.graph.educationSchool',
displayName: 'String',
description: 'String',
externalSource: 'String',
externalSourceDetail: 'String',
principalEmail: 'String',
principalName: 'String',
externalPrincipalId: 'String',
lowestGrade: 'String',
highestGrade: 'String',
schoolNumber: 'String',
externalId: 'String',
phone: 'String',
fax: 'String',
createdBy: {
'@odata.type': 'microsoft.graph.identitySet'
},
address: {
'@odata.type': 'microsoft.graph.physicalAddress'
}
};
await client.api('/education/schools')
.post(educationSchool);
Para obtener más información sobre cómo agregar el SDK al proyecto y crear una instancia de authProvider, consulte la documentación del SDK.
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\EducationSchool;
use Microsoft\Graph\Generated\Models\EducationExternalSource;
use Microsoft\Graph\Generated\Models\IdentitySet;
use Microsoft\Graph\Generated\Models\PhysicalAddress;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new EducationSchool();
$requestBody->setOdataType('#microsoft.graph.educationSchool');
$requestBody->setDisplayName('String');
$requestBody->setDescription('String');
$requestBody->setExternalSource(new EducationExternalSource('string'));
$requestBody->setExternalSourceDetail('String');
$requestBody->setPrincipalEmail('String');
$requestBody->setPrincipalName('String');
$requestBody->setExternalPrincipalId('String');
$requestBody->setLowestGrade('String');
$requestBody->setHighestGrade('String');
$requestBody->setSchoolNumber('String');
$requestBody->setExternalId('String');
$requestBody->setPhone('String');
$requestBody->setFax('String');
$createdBy = new IdentitySet();
$createdBy->setOdataType('microsoft.graph.identitySet');
$requestBody->setCreatedBy($createdBy);
$address = new PhysicalAddress();
$address->setOdataType('microsoft.graph.physicalAddress');
$requestBody->setAddress($address);
$result = $graphServiceClient->education()->schools()->post($requestBody)->wait();
Para obtener más información sobre cómo agregar el SDK al proyecto y crear una instancia de authProvider, consulte la documentación del SDK.
Import-Module Microsoft.Graph.Education
$params = @{
"@odata.type" = "#microsoft.graph.educationSchool"
displayName = "String"
description = "String"
externalSource = "String"
externalSourceDetail = "String"
principalEmail = "String"
principalName = "String"
externalPrincipalId = "String"
lowestGrade = "String"
highestGrade = "String"
schoolNumber = "String"
externalId = "String"
phone = "String"
fax = "String"
createdBy = @{
"@odata.type" = "microsoft.graph.identitySet"
}
address = @{
"@odata.type" = "microsoft.graph.physicalAddress"
}
}
New-MgEducationSchool -BodyParameter $params
Para obtener más información sobre cómo agregar el SDK al proyecto y crear una instancia de authProvider, consulte la documentación del SDK.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.education_school import EducationSchool
from msgraph.generated.models.education_external_source import EducationExternalSource
from msgraph.generated.models.identity_set import IdentitySet
from msgraph.generated.models.physical_address import PhysicalAddress
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = EducationSchool(
odata_type = "#microsoft.graph.educationSchool",
display_name = "String",
description = "String",
external_source = EducationExternalSource.Sis,
external_source_detail = "String",
principal_email = "String",
principal_name = "String",
external_principal_id = "String",
lowest_grade = "String",
highest_grade = "String",
school_number = "String",
external_id = "String",
phone = "String",
fax = "String",
created_by = IdentitySet(
odata_type = "microsoft.graph.identitySet",
),
address = PhysicalAddress(
odata_type = "microsoft.graph.physicalAddress",
),
)
result = await graph_client.education.schools.post(request_body)
Para obtener más información sobre cómo agregar el SDK al proyecto y crear una instancia de authProvider, consulte la documentación del SDK.
Respuesta
Nota: Se puede acortar el objeto de respuesta que se muestra aquí para mejorar la legibilidad.
HTTP/1.1 201 Created
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.educationSchool",
"id": "1c23c12e-c12e-1c23-2ec1-231c2ec1231c",
"displayName": "String",
"description": "String",
"externalSource": "String",
"externalSourceDetail": "String",
"principalEmail": "String",
"principalName": "String",
"externalPrincipalId": "String",
"lowestGrade": "String",
"highestGrade": "String",
"schoolNumber": "String",
"externalId": "String",
"phone": "String",
"fax": "String",
"createdBy": {
"@odata.type": "microsoft.graph.identitySet"
},
"address": {
"@odata.type": "microsoft.graph.physicalAddress"
}
}