Espace de noms: microsoft.graph
Importante
Les API sous la version /beta dans Microsoft Graph sont susceptibles d’être modifiées. L’utilisation de ces API dans des applications de production n’est pas prise en charge. Pour déterminer si une API est disponible dans v1.0, utilisez le sélecteur Version .
Créez un objet place .
Vous pouvez également utiliser cette méthode pour créer les types d’objets enfants suivants : bâtiment, étage, coupe, salle, espace de travail ou bureau.
Cette API est disponible dans les déploiements cloud nationaux suivants.
| Service global |
Gouvernement américain L4 |
Gouvernement américain L5 (DOD) |
Chine exploitée par 21Vianet |
| ✅ |
✅ |
✅ |
✅ |
Autorisations
Choisissez l’autorisation ou les autorisations marquées comme étant les moins privilégiées pour cette API. Utilisez une ou plusieurs autorisations privilégiées uniquement si votre application en a besoin. Pour plus d’informations sur les autorisations déléguées et d’application, voir Types d’autorisations. Pour en savoir plus sur ces autorisations, consultez la référence des autorisations.
| Type d’autorisation |
Autorisations les moins privilégiées |
Autorisations à privilèges plus élevés |
| Déléguée (compte professionnel ou scolaire) |
Place.ReadWrite.All |
Non disponible. |
| Déléguée (compte Microsoft personnel) |
Non prise en charge. |
Non prise en charge. |
| Application |
Place.ReadWrite.All |
Non disponible. |
Importante
Pour l’accès délégué à l’aide de comptes professionnels ou scolaires, l’utilisateur connecté doit disposer d’un rôle Microsoft Entra pris en charge ou d’un rôle personnalisé qui accorde les autorisations requises pour cette opération.
Administrateur Exchange est le rôle le moins privilégié pris en charge pour cette opération.
Lorsque vous utilisez des autorisations d’application, vous devez configurer le rôle requis TenantPlacesManagement (pour gérer les Places) et le rôle (pour gérer les utilisateurs et les MailRecipient boîtes aux lettres). Pour plus d’informations sur la configuration de ces rôles, consultez Access Control basées sur les rôles pour les applications dans Exchange Online.
Requête HTTP
POST /places
Corps de la demande
Dans le corps de la demande, fournissez une représentation JSON de l’objet place .
Pour obtenir la liste de toutes les propriétés disponibles lorsque vous créez un objet place , consultez la ressource place .
Réponse
En cas de réussite, cette méthode renvoie un 201 Created code de réponse et un objet place dans le corps de la réponse.
Exemples
Exemple 1 : Créer un bâtiment
L’exemple suivant montre comment créer un objet de construction .
Demande
L’exemple suivant illustre une demande.
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)
Réponse
L’exemple suivant illustre la réponse.
Remarque : l’objet de réponse affiché ci-après peut être raccourci pour plus de lisibilité.
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"
}
Exemple 2 : créer un plancher
L’exemple suivant montre comment créer un nouvel objet floor .
Demande
L’exemple suivant illustre une demande.
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)
Réponse
L’exemple suivant illustre la réponse.
Remarque : l’objet de réponse affiché ci-après peut être raccourci pour plus de lisibilité.
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
}
Exemple 3 : Créer une section
L’exemple suivant montre comment créer un objet de section .
Demande
L’exemple suivant illustre une demande.
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)
Réponse
L’exemple suivant illustre la réponse.
Remarque : l’objet de réponse affiché ci-après peut être raccourci pour plus de lisibilité.
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
}
Exemple 4 : Créer un bureau
L’exemple suivant montre comment créer un objet bureau .
Demande
L’exemple suivant illustre une demande.
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)
Réponse
L’exemple suivant illustre la réponse.
Remarque : l’objet de réponse affiché ci-après peut être raccourci pour plus de lisibilité.
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"
}
}
Exemple 5 : Créer une salle
L’exemple suivant montre comment créer un objet Salle .
Demande
L’exemple suivant illustre une demande.
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)
Réponse
L’exemple suivant illustre la réponse.
Remarque : l’objet de réponse affiché ci-après peut être raccourci pour plus de lisibilité.
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"
}
Exemple 6 : Créer un espace de travail
L’exemple suivant montre comment créer un objet d’espace de travail .
Demande
L’exemple suivant illustre une demande.
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)
Réponse
L’exemple suivant illustre la réponse.
Remarque : l’objet de réponse affiché ici peut être raccourci pour plus de lisibilité.
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"
}
}