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 .
Mettez à jour les propriétés de l’objet de lieu qui peut être un bâtiment, un étage, une section, un bureau, une salle, un espace de travail ou une liste de salles. Vous pouvez identifier le lieu en spécifiant la propriété id .
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. Cette API n’honore pas les rôles administratifs attribués aux groupes dans Microsoft Entra ID. Au lieu de cela, attribuez le rôle requis directement à l’utilisateur dans Microsoft Entra ID, ou attribuez-le à un utilisateur ou à un groupe via le Centre d’administration Microsoft 365.
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
PATCH /places/{id}
Remarque :{id} est l’identifiant unique de l’emplacement à mettre à jour.
Corps de la demande
Dans le corps de la demande, fournissez uniquement les valeurs des propriétés à mettre à jour. Les propriétés existantes qui ne sont pas incluses dans le corps de la demande conservent leurs valeurs précédentes ou sont recalculées en fonction des modifications apportées à d’autres valeurs de propriété.
Le tableau suivant spécifie les propriétés qui peuvent être mises à jour.
Une seule instance d’une ressource de lieu peut être mise à jour à la fois. Dans le corps de la demande, utilisez @odata.type pour spécifier le type de lieu et inclure les propriétés à mettre à jour.
Remarque
Vous ne pouvez pas utiliser cette API pour mettre à jour l’id, placeId, emailAddress, displayName ou bookingType d’un objet place .
| Propriété |
Type |
Description |
| address |
physicalAddress |
Adresse physique du lieu, y compris la rue, la ville, l’état, le pays ou la région et le code postal. Facultatif. |
| propriétés personnalisées |
stringDictionary |
Paires valeur-clé personnalisées associées à l’emplacement. Chaque valeur stockée doit être une chaîne. Définissez une valeur pour null supprimer l’entrée correspondante. Facultatif. |
| geoCoordinates |
outlookGeoCoordinates |
Spécifie l’emplacement du lieu en coordonnées de latitude, de longitude et (éventuellement) d’altitude. Facultatif. |
| isWheelChairAccessible |
Booléen |
Indique si l’endroit est accessible aux fauteuils roulants. Obligatoire. |
| étiquette |
String |
Description du lieu définie par l’utilisateur. Facultatif. |
| parentId |
String |
ID d’un emplacement parent. Facultatif. |
| phone |
String |
Numéro de téléphone de l’endroit. Facultatif. |
| étiquettes |
String collection |
Étiquettes personnalisées associées à l’emplacement pour la catégorisation ou le filtrage. Obligatoire. |
Réponse
En cas de réussite, cette méthode renvoie un code de 200 OK réponse et un objet PLACE mis à jour dans le corps de la réponse.
Exemples
Exemple 1 : mettre à jour un bâtiment
L’exemple suivant montre comment mettre à jour un objet de génération .
Demande
L’exemple suivant illustre une demande.
PATCH https://graph.microsoft.com/beta/places/e18a8e21-0494-4296-a5bc-f848dba2740d
Content-Type: application/json
{
"@odata.type": "microsoft.graph.building",
"customProperties": {
"campusCode": "SEA",
"costCenter": "CC-2048"
},
"tags": ["most popular building"]
}
// 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",
Tags = new List<string>
{
"most popular building",
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Places["{place-id}"].PatchAsync(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()
tags := []string {
"most popular building",
}
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().ByPlaceId("place-id").Patch(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");
LinkedList<String> tags = new LinkedList<String>();
tags.add("most popular building");
place.setTags(tags);
Place result = graphClient.places().byPlaceId("{place-id}").patch(place);
const options = {
authProvider,
};
const client = Client.init(options);
const place = {
'@odata.type': 'microsoft.graph.building',
tags: ['most popular building']
};
await client.api('/places/e18a8e21-0494-4296-a5bc-f848dba2740d')
.version('beta')
.update(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->setTags(['most popular building', ]);
$result = $graphServiceClient->places()->byPlaceId('place-id')->patch($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Calendar
$params = @{
"@odata.type" = "microsoft.graph.building"
tags = @(
"most popular building"
)
}
Update-MgBetaPlace -PlaceId $placeId -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",
tags = [
"most popular building",
],
)
result = await graph_client.places.by_place_id('place-id').patch(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 200 OK
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.building",
"id": "e18a8e21-0494-4296-a5bc-f848dba2740d",
"placeId": "e18a8e21-0494-4296-a5bc-f848dba2740d",
"displayName": "MRS",
"phone": "8801733457",
"tags": [
"most popular building"
],
"isWheelChairAccessible": true,
"label": "this is a building not open to all",
"hasWiFi": false,
"geoCoordinates": {
"latitude": 31.2513263,
"longitude": 121.3912291,
"accuracy": null,
"altitude": null,
"altitudeAccuracy": null
},
"resourceLinks": []
}
Exemple 2 : mettre à jour un plancher
L’exemple suivant montre comment mettre à jour un objet floor .
Demande
L’exemple suivant illustre une demande.
PATCH https://graph.microsoft.com/beta/places/c64205d0-1a2d-4cfe-9012-3f5d668d28ea
Content-Type: application/json
{
"@odata.type": "microsoft.graph.floor",
"isWheelChairAccessible": true,
"sortOrder": 2
}
// 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",
IsWheelChairAccessible = true,
SortOrder = 2,
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Places["{place-id}"].PatchAsync(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()
isWheelChairAccessible := true
requestBody.SetIsWheelChairAccessible(&isWheelChairAccessible)
sortOrder := int32(2)
requestBody.SetSortOrder(&sortOrder)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
places, err := graphClient.Places().ByPlaceId("place-id").Patch(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.setIsWheelChairAccessible(true);
place.setSortOrder(2);
Place result = graphClient.places().byPlaceId("{place-id}").patch(place);
const options = {
authProvider,
};
const client = Client.init(options);
const place = {
'@odata.type': 'microsoft.graph.floor',
isWheelChairAccessible: true,
sortOrder: 2
};
await client.api('/places/c64205d0-1a2d-4cfe-9012-3f5d668d28ea')
.version('beta')
.update(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->setIsWheelChairAccessible(true);
$requestBody->setSortOrder(2);
$result = $graphServiceClient->places()->byPlaceId('place-id')->patch($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Calendar
$params = @{
"@odata.type" = "microsoft.graph.floor"
isWheelChairAccessible = $true
sortOrder =
}
Update-MgBetaPlace -PlaceId $placeId -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",
is_wheel_chair_accessible = True,
sort_order = 2,
)
result = await graph_client.places.by_place_id('place-id').patch(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 200 OK
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.floor",
"id": "c64205d0-1a2d-4cfe-9012-3f5d668d28ea",
"placeId": "c64205d0-1a2d-4cfe-9012-3f5d668d28ea",
"displayName": "Floor X",
"parentId": "be7b53f1-7c63-4533-91d4-52c3ca856afb",
"isWheelChairAccessible": true,
"sortOrder": 2,
"geoCoordinates": {
"latitude": 0.0,
"longitude": 0.0,
"accuracy": null,
"altitude": null,
"altitudeAccuracy": null
}
}
Exemple 3 : Mettre à jour une section
L’exemple suivant montre comment mettre à jour un objet de section .
Demande
L’exemple suivant illustre une demande.
PATCH https://graph.microsoft.com/beta/places/3e7160bb-75da-4456-ab3c-5ee061f4611a
Content-Type: application/json
{
"@odata.type": "microsoft.graph.section",
"label": "discuss area"
}
// 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",
Label = "discuss area",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Places["{place-id}"].PatchAsync(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()
label := "discuss area"
requestBody.SetLabel(&label)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
places, err := graphClient.Places().ByPlaceId("place-id").Patch(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.setLabel("discuss area");
Place result = graphClient.places().byPlaceId("{place-id}").patch(place);
const options = {
authProvider,
};
const client = Client.init(options);
const place = {
'@odata.type': 'microsoft.graph.section',
label: 'discuss area'
};
await client.api('/places/3e7160bb-75da-4456-ab3c-5ee061f4611a')
.version('beta')
.update(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->setLabel('discuss area');
$result = $graphServiceClient->places()->byPlaceId('place-id')->patch($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Calendar
$params = @{
"@odata.type" = "microsoft.graph.section"
label = "discuss area"
}
Update-MgBetaPlace -PlaceId $placeId -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",
label = "discuss area",
)
result = await graph_client.places.by_place_id('place-id').patch(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 200 OK
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.section",
"id": "3e7160bb-75da-4456-ab3c-5ee061f4611a",
"placeId": "3e7160bb-75da-4456-ab3c-5ee061f4611a",
"displayName": "section_1",
"parentId": "e30d4c71-95bf-4576-be4f-b6b7a8d2eeb7",
"isWheelChairAccessible": false,
"label": "discuss area"
}
Exemple 4 : Mettre à jour un bureau
L’exemple suivant montre comment mettre à jour un objet de bureau .
Demande
L’exemple suivant illustre une demande.
PATCH https://graph.microsoft.com/beta/places/530f7900-8063-4daf-9cc1-168cb3ac26e9
Content-Type: application/json
{
"@odata.type": "microsoft.graph.desk",
"mode": {
"@odata.type": "microsoft.graph.dropInPlaceMode"
}
}
// 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",
Mode = new DropInPlaceMode
{
OdataType = "microsoft.graph.dropInPlaceMode",
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Places["{place-id}"].PatchAsync(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()
mode := graphmodels.NewDropInPlaceMode()
requestBody.SetMode(mode)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
places, err := graphClient.Places().ByPlaceId("place-id").Patch(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");
DropInPlaceMode mode = new DropInPlaceMode();
mode.setOdataType("microsoft.graph.dropInPlaceMode");
place.setMode(mode);
Place result = graphClient.places().byPlaceId("{place-id}").patch(place);
const options = {
authProvider,
};
const client = Client.init(options);
const place = {
'@odata.type': 'microsoft.graph.desk',
mode: {
'@odata.type': 'microsoft.graph.dropInPlaceMode'
}
};
await client.api('/places/530f7900-8063-4daf-9cc1-168cb3ac26e9')
.version('beta')
.update(place);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\Desk;
use Microsoft\Graph\Beta\Generated\Models\DropInPlaceMode;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Desk();
$requestBody->setOdataType('microsoft.graph.desk');
$mode = new DropInPlaceMode();
$mode->setOdataType('microsoft.graph.dropInPlaceMode');
$requestBody->setMode($mode);
$result = $graphServiceClient->places()->byPlaceId('place-id')->patch($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Calendar
$params = @{
"@odata.type" = "microsoft.graph.desk"
mode = @{
"@odata.type" = "microsoft.graph.dropInPlaceMode"
}
}
Update-MgBetaPlace -PlaceId $placeId -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
from msgraph_beta.generated.models.drop_in_place_mode import DropInPlaceMode
# 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",
mode = DropInPlaceMode(
odata_type = "microsoft.graph.dropInPlaceMode",
),
)
result = await graph_client.places.by_place_id('place-id').patch(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 200 OK
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.desk",
"id": "530f7900-8063-4daf-9cc1-168cb3ac26e9",
"placeId": "530f7900-8063-4daf-9cc1-168cb3ac26e9",
"displayName": "desk 5",
"parentId": "ca163ae1-14a3-4e2a-8a97-5f82d672186f",
"isWheelChairAccessible": true,
"mailboxDetails": {
"externalDirectoryObjectId": "04c6ff74-9268-41aa-96b5-5637d9f039bf",
"emailAddress": "desk5ca86f9b61753443541750@contoso.com"
},
"mode": {
"@odata.type": "#microsoft.graph.dropInPlaceMode"
}
}
Exemple 5 : Mise à jour d’une salle
L’exemple suivant montre comment mettre à jour un objet salle .
Demande
L’exemple suivant illustre une demande.
PATCH https://graph.microsoft.com/beta/places/cf100@contoso.com
Content-Type: application/json
{
"@odata.type": "microsoft.graph.room",
"nickname": "Conf Room",
"building": "1",
"label": "100",
"capacity": 50,
"isWheelChairAccessible": false
}
// 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",
Nickname = "Conf Room",
Building = "1",
Label = "100",
Capacity = 50,
IsWheelChairAccessible = false,
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Places["{place-id}"].PatchAsync(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()
nickname := "Conf Room"
requestBody.SetNickname(&nickname)
building := "1"
requestBody.SetBuilding(&building)
label := "100"
requestBody.SetLabel(&label)
capacity := int32(50)
requestBody.SetCapacity(&capacity)
isWheelChairAccessible := false
requestBody.SetIsWheelChairAccessible(&isWheelChairAccessible)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
places, err := graphClient.Places().ByPlaceId("place-id").Patch(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.setNickname("Conf Room");
place.setBuilding("1");
place.setLabel("100");
place.setCapacity(50);
place.setIsWheelChairAccessible(false);
Place result = graphClient.places().byPlaceId("{place-id}").patch(place);
const options = {
authProvider,
};
const client = Client.init(options);
const place = {
'@odata.type': 'microsoft.graph.room',
nickname: 'Conf Room',
building: '1',
label: '100',
capacity: 50,
isWheelChairAccessible: false
};
await client.api('/places/cf100@contoso.com')
.version('beta')
.update(place);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\Room;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Room();
$requestBody->setOdataType('microsoft.graph.room');
$requestBody->setNickname('Conf Room');
$requestBody->setBuilding('1');
$requestBody->setLabel('100');
$requestBody->setCapacity(50);
$requestBody->setIsWheelChairAccessible(false);
$result = $graphServiceClient->places()->byPlaceId('place-id')->patch($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Calendar
$params = @{
"@odata.type" = "microsoft.graph.room"
nickname = "Conf Room"
building = "1"
label = "100"
capacity =
isWheelChairAccessible = $false
}
Update-MgBetaPlace -PlaceId $placeId -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
# 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",
nickname = "Conf Room",
building = "1",
label = "100",
capacity = 50,
is_wheel_chair_accessible = False,
)
result = await graph_client.places.by_place_id('place-id').patch(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 200 OK
Content-Type: application/json
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#places/$entity",
"@odata.type": "#microsoft.graph.room",
"id": "3162F1E1-C4C0-604B-51D8-91DA78989EB1",
"emailAddress": "cf100@contoso.com",
"displayName": "Conf Room 100",
"address": {
"street": "4567 Main Street",
"city": "Buffalo",
"state": "NY",
"postalCode": "98052",
"countryOrRegion": "US"
},
"geoCoordinates": {
"latitude": 47.0,
"longitude": -122.0
},
"phone": "555-555-0100",
"nickname": "Conf Room",
"label": "100",
"capacity": 50,
"building": "1",
"floorLabel": "1P",
"floorNumber": 1,
"isWheelChairAccessible": false,
"bookingType": "standard",
"tags": [
"bean bags"
],
"audioDeviceName": null,
"videoDeviceName": null,
"displayDeviceName": "surface hub",
"placeId": "080ed1a0-7b54-4995-85a5-eeec751786f5"
}
Exemple 6 : Mettre à jour un espace de travail
L’exemple suivant montre comment mettre à jour un objet d’espace de travail .
Demande
L’exemple suivant illustre une demande.
PATCH https://graph.microsoft.com/beta/places/ws100@contoso.com
Content-Type: application/json
{
"@odata.type": "microsoft.graph.workspace",
"nickname": "Conf Room",
"building": "1",
"label": "100",
"capacity": 50,
"isWheelChairAccessible": false
}
// 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",
Nickname = "Conf Room",
Building = "1",
Label = "100",
Capacity = 50,
IsWheelChairAccessible = false,
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Places["{place-id}"].PatchAsync(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()
nickname := "Conf Room"
requestBody.SetNickname(&nickname)
building := "1"
requestBody.SetBuilding(&building)
label := "100"
requestBody.SetLabel(&label)
capacity := int32(50)
requestBody.SetCapacity(&capacity)
isWheelChairAccessible := false
requestBody.SetIsWheelChairAccessible(&isWheelChairAccessible)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
places, err := graphClient.Places().ByPlaceId("place-id").Patch(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.setNickname("Conf Room");
place.setBuilding("1");
place.setLabel("100");
place.setCapacity(50);
place.setIsWheelChairAccessible(false);
Place result = graphClient.places().byPlaceId("{place-id}").patch(place);
const options = {
authProvider,
};
const client = Client.init(options);
const place = {
'@odata.type': 'microsoft.graph.workspace',
nickname: 'Conf Room',
building: '1',
label: '100',
capacity: 50,
isWheelChairAccessible: false
};
await client.api('/places/ws100@contoso.com')
.version('beta')
.update(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->setNickname('Conf Room');
$requestBody->setBuilding('1');
$requestBody->setLabel('100');
$requestBody->setCapacity(50);
$requestBody->setIsWheelChairAccessible(false);
$result = $graphServiceClient->places()->byPlaceId('place-id')->patch($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Calendar
$params = @{
"@odata.type" = "microsoft.graph.workspace"
nickname = "Conf Room"
building = "1"
label = "100"
capacity =
isWheelChairAccessible = $false
}
Update-MgBetaPlace -PlaceId $placeId -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",
nickname = "Conf Room",
building = "1",
label = "100",
capacity = 50,
is_wheel_chair_accessible = False,
)
result = await graph_client.places.by_place_id('place-id').patch(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 200 OK
Content-Type: application/json
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#places/$entity",
"@odata.type": "#microsoft.graph.workspace",
"id": "3162F1E1-C4C0-604B-51D8-91DA78989EB1",
"emailAddress": "ws100@contoso.com",
"displayName": "Workspace 100",
"address": {
"street": "4567 Main Street",
"city": "Buffalo",
"state": "NY",
"postalCode": "98052",
"countryOrRegion": "US"
},
"geoCoordinates": {
"latitude": 47.0,
"longitude": -122.0
},
"phone": "555-555-0100",
"nickname": "Workspace",
"label": "100",
"capacity": 50,
"building": "1",
"floorLabel": "1P",
"floorNumber": 1,
"isWheelChairAccessible": false,
"tags": [
"bean bags"
],
"placeId": "357e8ddc-8af5-4c7c-bc38-ddb3bcfec0d9"
}
Exemple 7 : mettre à jour une liste de salles
L’exemple suivant montre comment mettre à jour un objet roomList .
Demande
L’exemple suivant illustre une demande.
PATCH https://graph.microsoft.com/beta/places/Building1RroomList@contoso.com
Content-Type: application/json
{
"@odata.type": "microsoft.graph.roomList",
"displayName": "Building 1",
"phone": "555-555-0100",
"address": {
"street": "4567 Main Street",
"city": "Buffalo",
"state": "NY",
"postalCode": "98052",
"countryOrRegion": "US"
},
"geoCoordinates": {
"altitude": null,
"latitude": 47.0,
"longitude": -122.0,
"accuracy": null,
"altitudeAccuracy": null
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new RoomList
{
OdataType = "microsoft.graph.roomList",
DisplayName = "Building 1",
Phone = "555-555-0100",
Address = new PhysicalAddress
{
Street = "4567 Main Street",
City = "Buffalo",
State = "NY",
PostalCode = "98052",
CountryOrRegion = "US",
},
GeoCoordinates = new OutlookGeoCoordinates
{
Altitude = null,
Latitude = 47d,
Longitude = -122d,
Accuracy = null,
AltitudeAccuracy = null,
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Places["{place-id}"].PatchAsync(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 := "Building 1"
requestBody.SetDisplayName(&displayName)
phone := "555-555-0100"
requestBody.SetPhone(&phone)
address := graphmodels.NewPhysicalAddress()
street := "4567 Main Street"
address.SetStreet(&street)
city := "Buffalo"
address.SetCity(&city)
state := "NY"
address.SetState(&state)
postalCode := "98052"
address.SetPostalCode(&postalCode)
countryOrRegion := "US"
address.SetCountryOrRegion(&countryOrRegion)
requestBody.SetAddress(address)
geoCoordinates := graphmodels.NewOutlookGeoCoordinates()
altitude := null
geoCoordinates.SetAltitude(&altitude)
latitude := float64(47)
geoCoordinates.SetLatitude(&latitude)
longitude := float64(-122)
geoCoordinates.SetLongitude(&longitude)
accuracy := null
geoCoordinates.SetAccuracy(&accuracy)
altitudeAccuracy := null
geoCoordinates.SetAltitudeAccuracy(&altitudeAccuracy)
requestBody.SetGeoCoordinates(geoCoordinates)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
places, err := graphClient.Places().ByPlaceId("place-id").Patch(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
RoomList place = new RoomList();
place.setOdataType("microsoft.graph.roomList");
place.setDisplayName("Building 1");
place.setPhone("555-555-0100");
PhysicalAddress address = new PhysicalAddress();
address.setStreet("4567 Main Street");
address.setCity("Buffalo");
address.setState("NY");
address.setPostalCode("98052");
address.setCountryOrRegion("US");
place.setAddress(address);
OutlookGeoCoordinates geoCoordinates = new OutlookGeoCoordinates();
geoCoordinates.setAltitude(null);
geoCoordinates.setLatitude(47d);
geoCoordinates.setLongitude(-122d);
geoCoordinates.setAccuracy(null);
geoCoordinates.setAltitudeAccuracy(null);
place.setGeoCoordinates(geoCoordinates);
Place result = graphClient.places().byPlaceId("{place-id}").patch(place);
const options = {
authProvider,
};
const client = Client.init(options);
const place = {
'@odata.type': 'microsoft.graph.roomList',
displayName: 'Building 1',
phone: '555-555-0100',
address: {
street: '4567 Main Street',
city: 'Buffalo',
state: 'NY',
postalCode: '98052',
countryOrRegion: 'US'
},
geoCoordinates: {
altitude: null,
latitude: 47.0,
longitude: -122.0,
accuracy: null,
altitudeAccuracy: null
}
};
await client.api('/places/Building1RroomList@contoso.com')
.version('beta')
.update(place);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\RoomList;
use Microsoft\Graph\Beta\Generated\Models\PhysicalAddress;
use Microsoft\Graph\Beta\Generated\Models\OutlookGeoCoordinates;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new RoomList();
$requestBody->setOdataType('microsoft.graph.roomList');
$requestBody->setDisplayName('Building 1');
$requestBody->setPhone('555-555-0100');
$address = new PhysicalAddress();
$address->setStreet('4567 Main Street');
$address->setCity('Buffalo');
$address->setState('NY');
$address->setPostalCode('98052');
$address->setCountryOrRegion('US');
$requestBody->setAddress($address);
$geoCoordinates = new OutlookGeoCoordinates();
$geoCoordinates->setAltitude(null);
$geoCoordinates->setLatitude(47);
$geoCoordinates->setLongitude(-122);
$geoCoordinates->setAccuracy(null);
$geoCoordinates->setAltitudeAccuracy(null);
$requestBody->setGeoCoordinates($geoCoordinates);
$result = $graphServiceClient->places()->byPlaceId('place-id')->patch($requestBody)->wait();
# 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_list import RoomList
from msgraph_beta.generated.models.physical_address import PhysicalAddress
from msgraph_beta.generated.models.outlook_geo_coordinates import OutlookGeoCoordinates
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = RoomList(
odata_type = "microsoft.graph.roomList",
display_name = "Building 1",
phone = "555-555-0100",
address = PhysicalAddress(
street = "4567 Main Street",
city = "Buffalo",
state = "NY",
postal_code = "98052",
country_or_region = "US",
),
geo_coordinates = OutlookGeoCoordinates(
altitude = None,
latitude = 47,
longitude = -122,
accuracy = None,
altitude_accuracy = None,
),
)
result = await graph_client.places.by_place_id('place-id').patch(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 200 OK
Content-Type: application/json
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#places/$entity",
"@odata.type": "#microsoft.graph.roomList",
"id": "DC404124-302A-92AA-F98D-7B4DEB0C1705",
"displayName": "Building 1",
"address": {
"street": "4567 Main Street",
"city": "Buffalo",
"state": "NY",
"postalCode": "98052",
"countryOrRegion": "US"
},
"geoCoordinates": {
"altitude": null,
"latitude": 47.0,
"longitude": -122.0,
"accuracy": null,
"altitudeAccuracy": null
},
"phone": "555-555-0100",
"emailAddress": "bldg1@contoso.com",
"placeId": "406bd1b2-237c-4710-bda2-8b7900d61b27"
}