Espacio de nombres: microsoft.graph
Importante
Las API de la versión /beta de Microsoft Graph están sujetas a cambios. No se admite el uso de estas API en aplicaciones de producción. Para determinar si una API está disponible en la versión 1.0, use el selector de Versión.
Crear un nuevo objeto de posición .
También puede utilizar este método para crear los siguientes tipos de objeto secundario: edificio, suelo, sección, sala, área de trabajo o escritorio.
Esta API está disponible en las siguientes implementaciones en la nube nacional.
| Servicio global |
Administración pública de EE. UU. |
Gobierno de EE. UU. L5 (DOD) |
China operado por 21Vianet |
| ✅ |
✅ |
✅ |
✅ |
Permissions
Elija el permiso o los permisos marcados como con privilegios mínimos para esta API. Use uno o varios permisos con privilegios más altos 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) |
Place.ReadWrite.All |
No disponible. |
| Delegado (cuenta personal de Microsoft) |
No admitida. |
No admitida. |
| Aplicación |
Place.ReadWrite.All |
No disponible. |
Importante
Para el acceso delegado con cuentas profesionales o educativas, el usuario que ha iniciado sesión debe tener asignado un rol compatible de Microsoft Entra o un rol personalizado que conceda los permisos necesarios para esta operación.
El rol de administrador de Exchange es el rol con privilegios mínimos admitido para esta operación.
Al usar permisos de aplicación, debe configurar el rol necesario TenantPlacesManagement (para administrar Places) y el MailRecipient rol (para administrar usuarios y buzones). Para obtener más información sobre cómo configurar estos roles, consulte Role Based Access Control for Applications in Exchange Online.
Solicitud HTTP
POST /places
| Nombre |
Descripción |
| Authorization |
{token} de portador. Obligatorio. Obtenga más información sobre autenticación y autorización. |
| Content-Type |
application/json. Obligatorio. |
Cuerpo de la solicitud
En el cuerpo de la solicitud, proporcione una representación JSON del objeto de lugar .
Para obtener una lista de todas las propiedades que están disponibles al crear un objeto de sitio , consulte el recurso de lugar .
Respuesta
Si tiene éxito, este método devuelve un 201 Created código de respuesta y un objeto place en el cuerpo de la respuesta.
Ejemplos
Ejemplo 1: Crear un edificio
En el siguiente ejemplo se muestra cómo crear un nuevo objeto de construcción .
Solicitud
En el ejemplo siguiente se muestra la solicitud.
POST https://graph.microsoft.com/beta/places
Content-Type: application/json
{
"@odata.type": "microsoft.graph.building",
"displayName": "B001"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new Building
{
OdataType = "microsoft.graph.building",
DisplayName = "B001",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Places.PostAsync(requestBody);
// 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.NewPlace()
displayName := "B001"
requestBody.SetDisplayName(&displayName)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
places, err := graphClient.Places().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
Building place = new Building();
place.setOdataType("microsoft.graph.building");
place.setDisplayName("B001");
Place result = graphClient.places().post(place);
const options = {
authProvider,
};
const client = Client.init(options);
const place = {
'@odata.type': 'microsoft.graph.building',
displayName: 'B001'
};
await client.api('/places')
.version('beta')
.post(place);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\Building;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Building();
$requestBody->setOdataType('microsoft.graph.building');
$requestBody->setDisplayName('B001');
$result = $graphServiceClient->places()->post($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Calendar
$params = @{
"@odata.type" = "microsoft.graph.building"
displayName = "B001"
}
New-MgBetaPlace -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.building import Building
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = Building(
odata_type = "microsoft.graph.building",
display_name = "B001",
)
result = await graph_client.places.post(request_body)
Respuesta
En el ejemplo siguiente se muestra la 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.building",
"id": "767a31a7-6987-41c9-b829-ab351b8aab53",
"placeId": "767a31a7-6987-41c9-b829-ab351b8aab53",
"displayName": "B001"
}
Ejemplo 2: Crear un piso
En el ejemplo siguiente se muestra cómo crear un nuevo objeto de suelo .
Solicitud
En el ejemplo siguiente se muestra la solicitud.
POST https://graph.microsoft.com/beta/places
Content-Type: application/json
{
"@odata.type": "microsoft.graph.floor",
"displayName": "F1",
"parentId": "767a31a7-6987-41c9-b829-ab351b8aab53"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new Floor
{
OdataType = "microsoft.graph.floor",
DisplayName = "F1",
ParentId = "767a31a7-6987-41c9-b829-ab351b8aab53",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Places.PostAsync(requestBody);
// 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.NewPlace()
displayName := "F1"
requestBody.SetDisplayName(&displayName)
parentId := "767a31a7-6987-41c9-b829-ab351b8aab53"
requestBody.SetParentId(&parentId)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
places, err := graphClient.Places().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
Floor place = new Floor();
place.setOdataType("microsoft.graph.floor");
place.setDisplayName("F1");
place.setParentId("767a31a7-6987-41c9-b829-ab351b8aab53");
Place result = graphClient.places().post(place);
const options = {
authProvider,
};
const client = Client.init(options);
const place = {
'@odata.type': 'microsoft.graph.floor',
displayName: 'F1',
parentId: '767a31a7-6987-41c9-b829-ab351b8aab53'
};
await client.api('/places')
.version('beta')
.post(place);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\Floor;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Floor();
$requestBody->setOdataType('microsoft.graph.floor');
$requestBody->setDisplayName('F1');
$requestBody->setParentId('767a31a7-6987-41c9-b829-ab351b8aab53');
$result = $graphServiceClient->places()->post($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Calendar
$params = @{
"@odata.type" = "microsoft.graph.floor"
displayName = "F1"
parentId = "767a31a7-6987-41c9-b829-ab351b8aab53"
}
New-MgBetaPlace -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.floor import Floor
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = Floor(
odata_type = "microsoft.graph.floor",
display_name = "F1",
parent_id = "767a31a7-6987-41c9-b829-ab351b8aab53",
)
result = await graph_client.places.post(request_body)
Respuesta
En el ejemplo siguiente se muestra la 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.floor",
"id": "46ef7aed-5d94-4fd4-ae03-b333bc7a6955",
"placeId": "46ef7aed-5d94-4fd4-ae03-b333bc7a6955",
"displayName": "F1",
"parentId": "767a31a7-6987-41c9-b829-ab351b8aab53",
"tags": [],
"isWheelChairAccessible": false
}
Ejemplo 3: Crear una sección
En el ejemplo siguiente se muestra cómo crear un nuevo objeto de sección .
Solicitud
En el ejemplo siguiente se muestra la solicitud.
POST https://graph.microsoft.com/beta/places
Content-Type: application/json
{
"@odata.type": "microsoft.graph.section",
"displayName": "S1",
"parentId": "46ef7aed-5d94-4fd4-ae03-b333bc7a6955"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new Section
{
OdataType = "microsoft.graph.section",
DisplayName = "S1",
ParentId = "46ef7aed-5d94-4fd4-ae03-b333bc7a6955",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Places.PostAsync(requestBody);
// 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.NewPlace()
displayName := "S1"
requestBody.SetDisplayName(&displayName)
parentId := "46ef7aed-5d94-4fd4-ae03-b333bc7a6955"
requestBody.SetParentId(&parentId)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
places, err := graphClient.Places().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
Section place = new Section();
place.setOdataType("microsoft.graph.section");
place.setDisplayName("S1");
place.setParentId("46ef7aed-5d94-4fd4-ae03-b333bc7a6955");
Place result = graphClient.places().post(place);
const options = {
authProvider,
};
const client = Client.init(options);
const place = {
'@odata.type': 'microsoft.graph.section',
displayName: 'S1',
parentId: '46ef7aed-5d94-4fd4-ae03-b333bc7a6955'
};
await client.api('/places')
.version('beta')
.post(place);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\Section;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Section();
$requestBody->setOdataType('microsoft.graph.section');
$requestBody->setDisplayName('S1');
$requestBody->setParentId('46ef7aed-5d94-4fd4-ae03-b333bc7a6955');
$result = $graphServiceClient->places()->post($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Calendar
$params = @{
"@odata.type" = "microsoft.graph.section"
displayName = "S1"
parentId = "46ef7aed-5d94-4fd4-ae03-b333bc7a6955"
}
New-MgBetaPlace -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.section import Section
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = Section(
odata_type = "microsoft.graph.section",
display_name = "S1",
parent_id = "46ef7aed-5d94-4fd4-ae03-b333bc7a6955",
)
result = await graph_client.places.post(request_body)
Respuesta
En el ejemplo siguiente se muestra la 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.section",
"id": "1ad0f725-6885-49c5-9a47-3b22a1f9409d",
"placeId": "1ad0f725-6885-49c5-9a47-3b22a1f9409d",
"displayName": "S1",
"parentId": "46ef7aed-5d94-4fd4-ae03-b333bc7a6955",
"tags": [],
"isWheelChairAccessible": false
}
Ejemplo 4: Crear un escritorio
En el ejemplo siguiente se muestra cómo crear un nuevo objeto de escritorio .
Solicitud
En el ejemplo siguiente se muestra la solicitud.
POST https://graph.microsoft.com/beta/places
Content-Type: application/json
{
"@odata.type": "microsoft.graph.desk",
"displayName": "D1",
"parentId": "1ad0f725-6885-49c5-9a47-3b22a1f9409d"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new Desk
{
OdataType = "microsoft.graph.desk",
DisplayName = "D1",
ParentId = "1ad0f725-6885-49c5-9a47-3b22a1f9409d",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Places.PostAsync(requestBody);
// 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.NewPlace()
displayName := "D1"
requestBody.SetDisplayName(&displayName)
parentId := "1ad0f725-6885-49c5-9a47-3b22a1f9409d"
requestBody.SetParentId(&parentId)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
places, err := graphClient.Places().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
Desk place = new Desk();
place.setOdataType("microsoft.graph.desk");
place.setDisplayName("D1");
place.setParentId("1ad0f725-6885-49c5-9a47-3b22a1f9409d");
Place result = graphClient.places().post(place);
const options = {
authProvider,
};
const client = Client.init(options);
const place = {
'@odata.type': 'microsoft.graph.desk',
displayName: 'D1',
parentId: '1ad0f725-6885-49c5-9a47-3b22a1f9409d'
};
await client.api('/places')
.version('beta')
.post(place);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\Desk;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Desk();
$requestBody->setOdataType('microsoft.graph.desk');
$requestBody->setDisplayName('D1');
$requestBody->setParentId('1ad0f725-6885-49c5-9a47-3b22a1f9409d');
$result = $graphServiceClient->places()->post($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Calendar
$params = @{
"@odata.type" = "microsoft.graph.desk"
displayName = "D1"
parentId = "1ad0f725-6885-49c5-9a47-3b22a1f9409d"
}
New-MgBetaPlace -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.desk import Desk
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = Desk(
odata_type = "microsoft.graph.desk",
display_name = "D1",
parent_id = "1ad0f725-6885-49c5-9a47-3b22a1f9409d",
)
result = await graph_client.places.post(request_body)
Respuesta
En el ejemplo siguiente se muestra la 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.desk",
"id": "fc25d4dc-817a-45bc-a72d-2616cd7566ac",
"placeId": "fc25d4dc-817a-45bc-a72d-2616cd7566ac",
"displayName": "D1",
"parentId": "1ad0f725-6885-49c5-9a47-3b22a1f9409d",
"tags": [],
"isWheelChairAccessible": false,
"mode": {
"@odata.type": "#microsoft.graph.unavailablePlaceMode",
"reason": "New"
}
}
Ejemplo 5: Crear una sala
En el ejemplo siguiente se muestra cómo crear un nuevo objeto de sala .
Solicitud
En el ejemplo siguiente se muestra la solicitud.
POST https://graph.microsoft.com/beta/places
Content-Type: application/json
{
"@odata.type": "microsoft.graph.room",
"displayName": "Conf Room 4/3.3G11",
"parentId": "46ef7aed-5d94-4fd4-ae03-b333bc7a6955",
"bookingType": "standard"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new Room
{
OdataType = "microsoft.graph.room",
DisplayName = "Conf Room 4/3.3G11",
ParentId = "46ef7aed-5d94-4fd4-ae03-b333bc7a6955",
BookingType = BookingType.Standard,
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Places.PostAsync(requestBody);
// 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.NewPlace()
displayName := "Conf Room 4/3.3G11"
requestBody.SetDisplayName(&displayName)
parentId := "46ef7aed-5d94-4fd4-ae03-b333bc7a6955"
requestBody.SetParentId(&parentId)
bookingType := graphmodels.STANDARD_BOOKINGTYPE
requestBody.SetBookingType(&bookingType)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
places, err := graphClient.Places().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
Room place = new Room();
place.setOdataType("microsoft.graph.room");
place.setDisplayName("Conf Room 4/3.3G11");
place.setParentId("46ef7aed-5d94-4fd4-ae03-b333bc7a6955");
place.setBookingType(BookingType.Standard);
Place result = graphClient.places().post(place);
const options = {
authProvider,
};
const client = Client.init(options);
const place = {
'@odata.type': 'microsoft.graph.room',
displayName: 'Conf Room 4/3.3G11',
parentId: '46ef7aed-5d94-4fd4-ae03-b333bc7a6955',
bookingType: 'standard'
};
await client.api('/places')
.version('beta')
.post(place);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\Room;
use Microsoft\Graph\Beta\Generated\Models\BookingType;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Room();
$requestBody->setOdataType('microsoft.graph.room');
$requestBody->setDisplayName('Conf Room 4/3.3G11');
$requestBody->setParentId('46ef7aed-5d94-4fd4-ae03-b333bc7a6955');
$requestBody->setBookingType(new BookingType('standard'));
$result = $graphServiceClient->places()->post($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Calendar
$params = @{
"@odata.type" = "microsoft.graph.room"
displayName = "Conf Room 4/3.3G11"
parentId = "46ef7aed-5d94-4fd4-ae03-b333bc7a6955"
bookingType = "standard"
}
New-MgBetaPlace -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.room import Room
from msgraph_beta.generated.models.booking_type import BookingType
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = Room(
odata_type = "microsoft.graph.room",
display_name = "Conf Room 4/3.3G11",
parent_id = "46ef7aed-5d94-4fd4-ae03-b333bc7a6955",
booking_type = BookingType.Standard,
)
result = await graph_client.places.post(request_body)
Respuesta
En el ejemplo siguiente se muestra la 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.room",
"id": "0be387a4-d53b-410f-9daf-f4fa07e5b05a",
"placeId": "4923e5a8-453e-4edf-b272-9c33757d4fb3",
"displayName": "Conf Room 4/3.3G11",
"parentId": "46ef7aed-5d94-4fd4-ae03-b333bc7a6955",
"isWheelChairAccessible": false,
"emailAddress": "confroom433G115497308f1755150217899@contoso.com",
"bookingType": "standard"
}
Ejemplo 6: Creación de un área de trabajo
En el ejemplo siguiente se muestra cómo crear un nuevo objeto de área de trabajo .
Solicitud
En el ejemplo siguiente se muestra la solicitud.
POST https://graph.microsoft.com/beta/places
Content-Type: application/json
{
"@odata.type": "microsoft.graph.workspace",
"parentId": "f7de7265-e420-47b4-9d49-28d728716241",
"displayName": "testSpace001",
"tags": ["test"]
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new Workspace
{
OdataType = "microsoft.graph.workspace",
ParentId = "f7de7265-e420-47b4-9d49-28d728716241",
DisplayName = "testSpace001",
Tags = new List<string>
{
"test",
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Places.PostAsync(requestBody);
// 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.NewPlace()
parentId := "f7de7265-e420-47b4-9d49-28d728716241"
requestBody.SetParentId(&parentId)
displayName := "testSpace001"
requestBody.SetDisplayName(&displayName)
tags := []string {
"test",
}
requestBody.SetTags(tags)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
places, err := graphClient.Places().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
Workspace place = new Workspace();
place.setOdataType("microsoft.graph.workspace");
place.setParentId("f7de7265-e420-47b4-9d49-28d728716241");
place.setDisplayName("testSpace001");
LinkedList<String> tags = new LinkedList<String>();
tags.add("test");
place.setTags(tags);
Place result = graphClient.places().post(place);
const options = {
authProvider,
};
const client = Client.init(options);
const place = {
'@odata.type': 'microsoft.graph.workspace',
parentId: 'f7de7265-e420-47b4-9d49-28d728716241',
displayName: 'testSpace001',
tags: ['test']
};
await client.api('/places')
.version('beta')
.post(place);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\Workspace;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Workspace();
$requestBody->setOdataType('microsoft.graph.workspace');
$requestBody->setParentId('f7de7265-e420-47b4-9d49-28d728716241');
$requestBody->setDisplayName('testSpace001');
$requestBody->setTags(['test', ]);
$result = $graphServiceClient->places()->post($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Calendar
$params = @{
"@odata.type" = "microsoft.graph.workspace"
parentId = "f7de7265-e420-47b4-9d49-28d728716241"
displayName = "testSpace001"
tags = @(
"test"
)
}
New-MgBetaPlace -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.workspace import Workspace
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = Workspace(
odata_type = "microsoft.graph.workspace",
parent_id = "f7de7265-e420-47b4-9d49-28d728716241",
display_name = "testSpace001",
tags = [
"test",
],
)
result = await graph_client.places.post(request_body)
Respuesta
En el ejemplo siguiente se muestra la 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.workspace",
"id": "49c2fcfb-163a-4e00-a42b-0615d6789e72",
"placeId": "d90144aa-8cc4-4d49-97f2-9c365e38ed7e",
"displayName": "testSpace001",
"parentId": "f7de7265-e420-47b4-9d49-28d728716241",
"tags": [
"test"
],
"emailAddress": "testSpace0015d9988631755150528582@contoso.com",
"nickname": "testSpace001",
"mode": {
"@odata.type": "#microsoft.graph.unavailablePlaceMode",
"reason": "New"
}
}