Criar educationSchool
-
Artigo
-
- 4 minutos para o fim da leitura
-
Namespace: microsoft.graph
Crie um novo objeto educationSchool.
Permissões
Uma das seguintes permissões é obrigatória para chamar esta API. Para saber mais, incluindo como escolher permissões, confira Permissões.
| Tipo de permissão |
Permissões (da com menos para a com mais privilégios) |
| Delegado (conta corporativa ou de estudante) |
Sem suporte. |
| Delegado (conta pessoal da Microsoft) |
Sem suporte. |
| Aplicativo |
EduRoster.ReadWrite.All |
Solicitação HTTP
POST /education/schools
| Nome |
Descrição |
| Autorização |
{token} de portador. Obrigatório. |
| Content-Type |
application/json. Obrigatório. |
Corpo da solicitação
No corpo da solicitação, fornece uma representação JSON do objeto educationSchool.
A tabela a seguir mostra as propriedades que são necessárias ao criar a educationSchool.
| Propriedade |
Tipo |
Descrição |
| displayName |
Cadeia de caracteres |
Nome de exibição da escola. Herdado de educationOrganization. |
| description |
Cadeia de caracteres |
Descrição da escola. Herdado de educationOrganization. |
| externalSource |
educationExternalSource |
Fonte de onde essa organização foi criada. Herdado de educationOrganization. Os valores possíveis são: sis , 'manual. |
| externalSourceDetail |
Cadeia de caracteres |
O nome da fonte externa de onde esses recursos foram gerados. |
| principalEmail |
Cadeia de caracteres |
Endereço de email da entidade de segurança. |
| principalName |
Cadeia de caracteres |
Nome da entidade de segurança. |
| externalPrincipalId |
Cadeia de caracteres |
ID da entidade de segurança no sistema de sincronização. |
| highestGrade |
Cadeia de caracteres |
Ensino de nível mais alto. |
| lowestGrade |
Cadeia de caracteres |
Ensino de nível mais baixo. |
| schoolNumber |
Cadeia de caracteres |
Número da escola. |
| externalId |
Cadeia de caracteres |
ID da escola no sistema de sincronização. |
| phone |
Cadeia de caracteres |
Número de telefone da escola. |
| fax |
Cadeia de caracteres |
Número de fax da escola. |
| createdBy |
identitySet |
Entidade que criou a escola. |
| address |
physicalAddress |
Endereço da escola. |
Resposta
Se bem-sucedido, esse método retornará um código de resposta 201 Created e um objeto educationSchool no corpo da resposta.
Exemplos
Solicitação
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"
}
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var educationSchool = new 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
{
},
Address = new PhysicalAddress
{
}
};
await graphClient.Education.Schools
.Request()
.AddAsync(educationSchool);
Para obter detalhes sobre como adicionar o SDK ao seu projeto e criar uma instância authProvider , consulte a documentação do 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 obter detalhes sobre como adicionar o SDK ao seu projeto e criar uma instância authProvider , consulte a documentação do SDK.
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/v1.0/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/education/schools"]]];
[urlRequest setHTTPMethod:@"POST"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
MSGraphEducationSchool *educationSchool = [[MSGraphEducationSchool alloc] init];
[educationSchool setDisplayName:@"String"];
[educationSchool setDescription:@"String"];
[educationSchool setExternalSource: [MSGraphEducationExternalSource 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"];
MSGraphIdentitySet *createdBy = [[MSGraphIdentitySet alloc] init];
[educationSchool setCreatedBy:createdBy];
MSGraphPhysicalAddress *address = [[MSGraphPhysicalAddress alloc] init];
[educationSchool setAddress:address];
NSError *error;
NSData *educationSchoolData = [educationSchool getSerializedDataWithError:&error];
[urlRequest setHTTPBody:educationSchoolData];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
//Request Completed
}];
[meDataTask execute];
Para obter detalhes sobre como adicionar o SDK ao seu projeto e criar uma instância authProvider , consulte a documentação do SDK.
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
EducationSchool educationSchool = new EducationSchool();
educationSchool.displayName = "String";
educationSchool.description = "String";
educationSchool.externalSource = EducationExternalSource.SIS;
educationSchool.externalSourceDetail = "String";
educationSchool.principalEmail = "String";
educationSchool.principalName = "String";
educationSchool.externalPrincipalId = "String";
educationSchool.lowestGrade = "String";
educationSchool.highestGrade = "String";
educationSchool.schoolNumber = "String";
educationSchool.externalId = "String";
educationSchool.phone = "String";
educationSchool.fax = "String";
IdentitySet createdBy = new IdentitySet();
educationSchool.createdBy = createdBy;
PhysicalAddress address = new PhysicalAddress();
educationSchool.address = address;
graphClient.education().schools()
.buildRequest()
.post(educationSchool);
Para obter detalhes sobre como adicionar o SDK ao seu projeto e criar uma instância authProvider , consulte a documentação do SDK.
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
requestBody := msgraphsdk.NewEducationSchool()
displayName := "String"
requestBody.SetDisplayName(&displayName)
description := "String"
requestBody.SetDescription(&description)
externalSource := "String"
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 := msgraphsdk.NewIdentitySet()
requestBody.SetCreatedBy(createdBy)
createdBy.SetAdditionalData(map[string]interface{}{
"@odata.type": "microsoft.graph.identitySet",
}
address := msgraphsdk.NewPhysicalAddress()
requestBody.SetAddress(address)
address.SetAdditionalData(map[string]interface{}{
"@odata.type": "microsoft.graph.physicalAddress",
}
requestBody.SetAdditionalData(map[string]interface{}{
"@odata.type": "#microsoft.graph.educationSchool",
}
result, err := graphClient.Education().Schools().Post(requestBody)
Para obter detalhes sobre como adicionar o SDK ao seu projeto e criar uma instância authProvider , consulte a documentação do 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 obter detalhes sobre como adicionar o SDK ao seu projeto e criar uma instância authProvider , consulte a documentação do SDK.
Resposta
Observação: o objeto de resposta mostrado aqui pode ser encurtado para legibilidade.
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"
}
}