APIs under the /beta version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.
Update the properties of a workplace sensor device.
Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.
Note
For an app with delegated permissions to write workplace devices, the signed-in user must be a member of the TenantPlacesManagement Exchange Online administrator role.
In the request body, provide the entire JSON for the workplaceSensorDevice object with updated fields. Partial updates aren't supported. If any optional property is excluded, it's set to null. To add new sensors, append a new sensor object to the existing sensor collection. If a sensor object is removed from the collection, it's deleted from the device.
The following table specifies the properties that can be updated.
Property
Type
Description
description
String
The description of the device. Optional.
deviceId
String
The user-defined unique identifier of the device provided at the time of creation. Required. Read-only.
displayName
String
The display name of the device. Optional.
ipV4Address
String
The IPv4 address of the device. Optional.
ipV6Address
String
The IPv6 address of the device. Optional.
macAddress
String
The MAC address of the device. Optional.
manufacturer
String
The manufacturer of the device. Required.
placeId
String
The unique identifier of the place where the device is located. If the device is installed in a room equipped with a mailbox, this property should match the ExternalDirectoryObjectId or Microsoft Entra object ID of the room mailbox. Optional.
A list of sensors associated with the device that collect and report data about physical or environmental conditions, such as occupancy, people count, inferred occupancy, temperature, and more. Required.
tags
String collection
A list of custom tags associated with the device. Supports $filter. Optional.
Response
If successful, this method returns a 200 OK response code and an updated workplaceSensorDevice object in the response body.
Examples
Example 1: Add a new tag
The following example shows how to add a new tag to a workplace sensor device.
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new WorkplaceSensorDevice
{
DeviceId = "contoso_9D6816",
DisplayName = "Contoso 9D6816 Device",
Description = "Contoso 9D6816 Device",
MacAddress = "00:0A:95:9D:68:16",
Manufacturer = "Contoso",
IpV4Address = "192.168.1.100",
IpV6Address = "2001:db8::ff00:42:8329",
PlaceId = "acfa3bc0-2b83-425b-8910-84a0250e9671",
Tags = new List<string>
{
"Building A",
"Floor 3",
"Room 301",
"Conference Room",
"v1.0.7",
},
Sensors = new List<WorkplaceSensor>
{
new WorkplaceSensor
{
SensorType = WorkplaceSensorType.Occupancy,
},
new WorkplaceSensor
{
SensorType = WorkplaceSensorType.PeopleCount,
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Workplace.SensorDevices["{workplaceSensorDevice-id}"].PatchAsync(requestBody);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
// 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.NewWorkplaceSensorDevice()
deviceId := "contoso_9D6816"
requestBody.SetDeviceId(&deviceId)
displayName := "Contoso 9D6816 Device"
requestBody.SetDisplayName(&displayName)
description := "Contoso 9D6816 Device"
requestBody.SetDescription(&description)
macAddress := "00:0A:95:9D:68:16"
requestBody.SetMacAddress(&macAddress)
manufacturer := "Contoso"
requestBody.SetManufacturer(&manufacturer)
ipV4Address := "192.168.1.100"
requestBody.SetIpV4Address(&ipV4Address)
ipV6Address := "2001:db8::ff00:42:8329"
requestBody.SetIpV6Address(&ipV6Address)
placeId := "acfa3bc0-2b83-425b-8910-84a0250e9671"
requestBody.SetPlaceId(&placeId)
tags := []string {
"Building A",
"Floor 3",
"Room 301",
"Conference Room",
"v1.0.7",
}
requestBody.SetTags(tags)
workplaceSensor := graphmodels.NewWorkplaceSensor()
sensorType := graphmodels.OCCUPANCY_WORKPLACESENSORTYPE
workplaceSensor.SetSensorType(&sensorType)
workplaceSensor1 := graphmodels.NewWorkplaceSensor()
sensorType := graphmodels.PEOPLECOUNT_WORKPLACESENSORTYPE
workplaceSensor1.SetSensorType(&sensorType)
sensors := []graphmodels.WorkplaceSensorable {
workplaceSensor,
workplaceSensor1,
}
requestBody.SetSensors(sensors)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
sensorDevices, err := graphClient.Workplace().SensorDevices().ByWorkplaceSensorDeviceId("workplaceSensorDevice-id").Patch(context.Background(), requestBody, nil)
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
WorkplaceSensorDevice workplaceSensorDevice = new WorkplaceSensorDevice();
workplaceSensorDevice.setDeviceId("contoso_9D6816");
workplaceSensorDevice.setDisplayName("Contoso 9D6816 Device");
workplaceSensorDevice.setDescription("Contoso 9D6816 Device");
workplaceSensorDevice.setMacAddress("00:0A:95:9D:68:16");
workplaceSensorDevice.setManufacturer("Contoso");
workplaceSensorDevice.setIpV4Address("192.168.1.100");
workplaceSensorDevice.setIpV6Address("2001:db8::ff00:42:8329");
workplaceSensorDevice.setPlaceId("acfa3bc0-2b83-425b-8910-84a0250e9671");
LinkedList<String> tags = new LinkedList<String>();
tags.add("Building A");
tags.add("Floor 3");
tags.add("Room 301");
tags.add("Conference Room");
tags.add("v1.0.7");
workplaceSensorDevice.setTags(tags);
LinkedList<WorkplaceSensor> sensors = new LinkedList<WorkplaceSensor>();
WorkplaceSensor workplaceSensor = new WorkplaceSensor();
workplaceSensor.setSensorType(WorkplaceSensorType.Occupancy);
sensors.add(workplaceSensor);
WorkplaceSensor workplaceSensor1 = new WorkplaceSensor();
workplaceSensor1.setSensorType(WorkplaceSensorType.PeopleCount);
sensors.add(workplaceSensor1);
workplaceSensorDevice.setSensors(sensors);
WorkplaceSensorDevice result = graphClient.workplace().sensorDevices().byWorkplaceSensorDeviceId("{workplaceSensorDevice-id}").patch(workplaceSensorDevice);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\WorkplaceSensorDevice;
use Microsoft\Graph\Beta\Generated\Models\WorkplaceSensor;
use Microsoft\Graph\Beta\Generated\Models\WorkplaceSensorType;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new WorkplaceSensorDevice();
$requestBody->setDeviceId('contoso_9D6816');
$requestBody->setDisplayName('Contoso 9D6816 Device');
$requestBody->setDescription('Contoso 9D6816 Device');
$requestBody->setMacAddress('00:0A:95:9D:68:16');
$requestBody->setManufacturer('Contoso');
$requestBody->setIpV4Address('192.168.1.100');
$requestBody->setIpV6Address('2001:db8::ff00:42:8329');
$requestBody->setPlaceId('acfa3bc0-2b83-425b-8910-84a0250e9671');
$requestBody->setTags(['Building A', 'Floor 3', 'Room 301', 'Conference Room', 'v1.0.7', ]);
$sensorsWorkplaceSensor1 = new WorkplaceSensor();
$sensorsWorkplaceSensor1->setSensorType(new WorkplaceSensorType('occupancy'));
$sensorsArray []= $sensorsWorkplaceSensor1;
$sensorsWorkplaceSensor2 = new WorkplaceSensor();
$sensorsWorkplaceSensor2->setSensorType(new WorkplaceSensorType('peopleCount'));
$sensorsArray []= $sensorsWorkplaceSensor2;
$requestBody->setSensors($sensorsArray);
$result = $graphServiceClient->workplace()->sensorDevices()->byWorkplaceSensorDeviceId('workplaceSensorDevice-id')->patch($requestBody)->wait();
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.workplace_sensor_device import WorkplaceSensorDevice
from msgraph_beta.generated.models.workplace_sensor import WorkplaceSensor
from msgraph_beta.generated.models.workplace_sensor_type import WorkplaceSensorType
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = WorkplaceSensorDevice(
device_id = "contoso_9D6816",
display_name = "Contoso 9D6816 Device",
description = "Contoso 9D6816 Device",
mac_address = "00:0A:95:9D:68:16",
manufacturer = "Contoso",
ip_v4_address = "192.168.1.100",
ip_v6_address = "2001:db8::ff00:42:8329",
place_id = "acfa3bc0-2b83-425b-8910-84a0250e9671",
tags = [
"Building A",
"Floor 3",
"Room 301",
"Conference Room",
"v1.0.7",
],
sensors = [
WorkplaceSensor(
sensor_type = WorkplaceSensorType.Occupancy,
),
WorkplaceSensor(
sensor_type = WorkplaceSensorType.PeopleCount,
),
],
)
result = await graph_client.workplace.sensor_devices.by_workplace_sensor_device_id('workplaceSensorDevice-id').patch(request_body)
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new WorkplaceSensorDevice
{
DeviceId = "contoso_9D6816",
DisplayName = "Contoso 9D6816 Device",
Description = "Contoso 9D6816 Device",
MacAddress = "00:0A:95:9D:68:16",
Manufacturer = "Contoso",
IpV4Address = "192.168.1.100",
IpV6Address = "2001:db8::ff00:42:8329",
PlaceId = "acfa3bc0-2b83-425b-8910-84a0250e9671",
Tags = new List<string>
{
"Building A",
"Floor 3",
"Room 301",
"Conference Room",
},
Sensors = new List<WorkplaceSensor>
{
new WorkplaceSensor
{
SensorType = WorkplaceSensorType.Occupancy,
},
new WorkplaceSensor
{
SensorType = WorkplaceSensorType.PeopleCount,
},
new WorkplaceSensor
{
SensorType = WorkplaceSensorType.InferredOccupancy,
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Workplace.SensorDevices["{workplaceSensorDevice-id}"].PatchAsync(requestBody);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
// 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.NewWorkplaceSensorDevice()
deviceId := "contoso_9D6816"
requestBody.SetDeviceId(&deviceId)
displayName := "Contoso 9D6816 Device"
requestBody.SetDisplayName(&displayName)
description := "Contoso 9D6816 Device"
requestBody.SetDescription(&description)
macAddress := "00:0A:95:9D:68:16"
requestBody.SetMacAddress(&macAddress)
manufacturer := "Contoso"
requestBody.SetManufacturer(&manufacturer)
ipV4Address := "192.168.1.100"
requestBody.SetIpV4Address(&ipV4Address)
ipV6Address := "2001:db8::ff00:42:8329"
requestBody.SetIpV6Address(&ipV6Address)
placeId := "acfa3bc0-2b83-425b-8910-84a0250e9671"
requestBody.SetPlaceId(&placeId)
tags := []string {
"Building A",
"Floor 3",
"Room 301",
"Conference Room",
}
requestBody.SetTags(tags)
workplaceSensor := graphmodels.NewWorkplaceSensor()
sensorType := graphmodels.OCCUPANCY_WORKPLACESENSORTYPE
workplaceSensor.SetSensorType(&sensorType)
workplaceSensor1 := graphmodels.NewWorkplaceSensor()
sensorType := graphmodels.PEOPLECOUNT_WORKPLACESENSORTYPE
workplaceSensor1.SetSensorType(&sensorType)
workplaceSensor2 := graphmodels.NewWorkplaceSensor()
sensorType := graphmodels.INFERREDOCCUPANCY_WORKPLACESENSORTYPE
workplaceSensor2.SetSensorType(&sensorType)
sensors := []graphmodels.WorkplaceSensorable {
workplaceSensor,
workplaceSensor1,
workplaceSensor2,
}
requestBody.SetSensors(sensors)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
sensorDevices, err := graphClient.Workplace().SensorDevices().ByWorkplaceSensorDeviceId("workplaceSensorDevice-id").Patch(context.Background(), requestBody, nil)
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
WorkplaceSensorDevice workplaceSensorDevice = new WorkplaceSensorDevice();
workplaceSensorDevice.setDeviceId("contoso_9D6816");
workplaceSensorDevice.setDisplayName("Contoso 9D6816 Device");
workplaceSensorDevice.setDescription("Contoso 9D6816 Device");
workplaceSensorDevice.setMacAddress("00:0A:95:9D:68:16");
workplaceSensorDevice.setManufacturer("Contoso");
workplaceSensorDevice.setIpV4Address("192.168.1.100");
workplaceSensorDevice.setIpV6Address("2001:db8::ff00:42:8329");
workplaceSensorDevice.setPlaceId("acfa3bc0-2b83-425b-8910-84a0250e9671");
LinkedList<String> tags = new LinkedList<String>();
tags.add("Building A");
tags.add("Floor 3");
tags.add("Room 301");
tags.add("Conference Room");
workplaceSensorDevice.setTags(tags);
LinkedList<WorkplaceSensor> sensors = new LinkedList<WorkplaceSensor>();
WorkplaceSensor workplaceSensor = new WorkplaceSensor();
workplaceSensor.setSensorType(WorkplaceSensorType.Occupancy);
sensors.add(workplaceSensor);
WorkplaceSensor workplaceSensor1 = new WorkplaceSensor();
workplaceSensor1.setSensorType(WorkplaceSensorType.PeopleCount);
sensors.add(workplaceSensor1);
WorkplaceSensor workplaceSensor2 = new WorkplaceSensor();
workplaceSensor2.setSensorType(WorkplaceSensorType.InferredOccupancy);
sensors.add(workplaceSensor2);
workplaceSensorDevice.setSensors(sensors);
WorkplaceSensorDevice result = graphClient.workplace().sensorDevices().byWorkplaceSensorDeviceId("{workplaceSensorDevice-id}").patch(workplaceSensorDevice);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\WorkplaceSensorDevice;
use Microsoft\Graph\Beta\Generated\Models\WorkplaceSensor;
use Microsoft\Graph\Beta\Generated\Models\WorkplaceSensorType;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new WorkplaceSensorDevice();
$requestBody->setDeviceId('contoso_9D6816');
$requestBody->setDisplayName('Contoso 9D6816 Device');
$requestBody->setDescription('Contoso 9D6816 Device');
$requestBody->setMacAddress('00:0A:95:9D:68:16');
$requestBody->setManufacturer('Contoso');
$requestBody->setIpV4Address('192.168.1.100');
$requestBody->setIpV6Address('2001:db8::ff00:42:8329');
$requestBody->setPlaceId('acfa3bc0-2b83-425b-8910-84a0250e9671');
$requestBody->setTags(['Building A', 'Floor 3', 'Room 301', 'Conference Room', ]);
$sensorsWorkplaceSensor1 = new WorkplaceSensor();
$sensorsWorkplaceSensor1->setSensorType(new WorkplaceSensorType('occupancy'));
$sensorsArray []= $sensorsWorkplaceSensor1;
$sensorsWorkplaceSensor2 = new WorkplaceSensor();
$sensorsWorkplaceSensor2->setSensorType(new WorkplaceSensorType('peopleCount'));
$sensorsArray []= $sensorsWorkplaceSensor2;
$sensorsWorkplaceSensor3 = new WorkplaceSensor();
$sensorsWorkplaceSensor3->setSensorType(new WorkplaceSensorType('inferredOccupancy'));
$sensorsArray []= $sensorsWorkplaceSensor3;
$requestBody->setSensors($sensorsArray);
$result = $graphServiceClient->workplace()->sensorDevices()->byWorkplaceSensorDeviceId('workplaceSensorDevice-id')->patch($requestBody)->wait();
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.workplace_sensor_device import WorkplaceSensorDevice
from msgraph_beta.generated.models.workplace_sensor import WorkplaceSensor
from msgraph_beta.generated.models.workplace_sensor_type import WorkplaceSensorType
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = WorkplaceSensorDevice(
device_id = "contoso_9D6816",
display_name = "Contoso 9D6816 Device",
description = "Contoso 9D6816 Device",
mac_address = "00:0A:95:9D:68:16",
manufacturer = "Contoso",
ip_v4_address = "192.168.1.100",
ip_v6_address = "2001:db8::ff00:42:8329",
place_id = "acfa3bc0-2b83-425b-8910-84a0250e9671",
tags = [
"Building A",
"Floor 3",
"Room 301",
"Conference Room",
],
sensors = [
WorkplaceSensor(
sensor_type = WorkplaceSensorType.Occupancy,
),
WorkplaceSensor(
sensor_type = WorkplaceSensorType.PeopleCount,
),
WorkplaceSensor(
sensor_type = WorkplaceSensorType.InferredOccupancy,
),
],
)
result = await graph_client.workplace.sensor_devices.by_workplace_sensor_device_id('workplaceSensorDevice-id').patch(request_body)
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new WorkplaceSensorDevice
{
DeviceId = "contoso_9D6816",
DisplayName = "Contoso 9D6816 Device",
Description = "Contoso 9D6816 Device",
MacAddress = "00:0A:95:9D:68:16",
Manufacturer = "Contoso",
IpV4Address = "192.168.1.100",
IpV6Address = "2001:db8::ff00:42:8329",
PlaceId = "acfa3bc0-2b83-425b-8910-84a0250e9671",
Tags = new List<string>
{
"Building A",
"Floor 3",
"Room 301",
"Conference Room",
},
Sensors = new List<WorkplaceSensor>
{
new WorkplaceSensor
{
SensorType = WorkplaceSensorType.PeopleCount,
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Workplace.SensorDevices["{workplaceSensorDevice-id}"].PatchAsync(requestBody);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
// 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.NewWorkplaceSensorDevice()
deviceId := "contoso_9D6816"
requestBody.SetDeviceId(&deviceId)
displayName := "Contoso 9D6816 Device"
requestBody.SetDisplayName(&displayName)
description := "Contoso 9D6816 Device"
requestBody.SetDescription(&description)
macAddress := "00:0A:95:9D:68:16"
requestBody.SetMacAddress(&macAddress)
manufacturer := "Contoso"
requestBody.SetManufacturer(&manufacturer)
ipV4Address := "192.168.1.100"
requestBody.SetIpV4Address(&ipV4Address)
ipV6Address := "2001:db8::ff00:42:8329"
requestBody.SetIpV6Address(&ipV6Address)
placeId := "acfa3bc0-2b83-425b-8910-84a0250e9671"
requestBody.SetPlaceId(&placeId)
tags := []string {
"Building A",
"Floor 3",
"Room 301",
"Conference Room",
}
requestBody.SetTags(tags)
workplaceSensor := graphmodels.NewWorkplaceSensor()
sensorType := graphmodels.PEOPLECOUNT_WORKPLACESENSORTYPE
workplaceSensor.SetSensorType(&sensorType)
sensors := []graphmodels.WorkplaceSensorable {
workplaceSensor,
}
requestBody.SetSensors(sensors)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
sensorDevices, err := graphClient.Workplace().SensorDevices().ByWorkplaceSensorDeviceId("workplaceSensorDevice-id").Patch(context.Background(), requestBody, nil)
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
WorkplaceSensorDevice workplaceSensorDevice = new WorkplaceSensorDevice();
workplaceSensorDevice.setDeviceId("contoso_9D6816");
workplaceSensorDevice.setDisplayName("Contoso 9D6816 Device");
workplaceSensorDevice.setDescription("Contoso 9D6816 Device");
workplaceSensorDevice.setMacAddress("00:0A:95:9D:68:16");
workplaceSensorDevice.setManufacturer("Contoso");
workplaceSensorDevice.setIpV4Address("192.168.1.100");
workplaceSensorDevice.setIpV6Address("2001:db8::ff00:42:8329");
workplaceSensorDevice.setPlaceId("acfa3bc0-2b83-425b-8910-84a0250e9671");
LinkedList<String> tags = new LinkedList<String>();
tags.add("Building A");
tags.add("Floor 3");
tags.add("Room 301");
tags.add("Conference Room");
workplaceSensorDevice.setTags(tags);
LinkedList<WorkplaceSensor> sensors = new LinkedList<WorkplaceSensor>();
WorkplaceSensor workplaceSensor = new WorkplaceSensor();
workplaceSensor.setSensorType(WorkplaceSensorType.PeopleCount);
sensors.add(workplaceSensor);
workplaceSensorDevice.setSensors(sensors);
WorkplaceSensorDevice result = graphClient.workplace().sensorDevices().byWorkplaceSensorDeviceId("{workplaceSensorDevice-id}").patch(workplaceSensorDevice);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\WorkplaceSensorDevice;
use Microsoft\Graph\Beta\Generated\Models\WorkplaceSensor;
use Microsoft\Graph\Beta\Generated\Models\WorkplaceSensorType;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new WorkplaceSensorDevice();
$requestBody->setDeviceId('contoso_9D6816');
$requestBody->setDisplayName('Contoso 9D6816 Device');
$requestBody->setDescription('Contoso 9D6816 Device');
$requestBody->setMacAddress('00:0A:95:9D:68:16');
$requestBody->setManufacturer('Contoso');
$requestBody->setIpV4Address('192.168.1.100');
$requestBody->setIpV6Address('2001:db8::ff00:42:8329');
$requestBody->setPlaceId('acfa3bc0-2b83-425b-8910-84a0250e9671');
$requestBody->setTags(['Building A', 'Floor 3', 'Room 301', 'Conference Room', ]);
$sensorsWorkplaceSensor1 = new WorkplaceSensor();
$sensorsWorkplaceSensor1->setSensorType(new WorkplaceSensorType('peopleCount'));
$sensorsArray []= $sensorsWorkplaceSensor1;
$requestBody->setSensors($sensorsArray);
$result = $graphServiceClient->workplace()->sensorDevices()->byWorkplaceSensorDeviceId('workplaceSensorDevice-id')->patch($requestBody)->wait();
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.workplace_sensor_device import WorkplaceSensorDevice
from msgraph_beta.generated.models.workplace_sensor import WorkplaceSensor
from msgraph_beta.generated.models.workplace_sensor_type import WorkplaceSensorType
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = WorkplaceSensorDevice(
device_id = "contoso_9D6816",
display_name = "Contoso 9D6816 Device",
description = "Contoso 9D6816 Device",
mac_address = "00:0A:95:9D:68:16",
manufacturer = "Contoso",
ip_v4_address = "192.168.1.100",
ip_v6_address = "2001:db8::ff00:42:8329",
place_id = "acfa3bc0-2b83-425b-8910-84a0250e9671",
tags = [
"Building A",
"Floor 3",
"Room 301",
"Conference Room",
],
sensors = [
WorkplaceSensor(
sensor_type = WorkplaceSensorType.PeopleCount,
),
],
)
result = await graph_client.workplace.sensor_devices.by_workplace_sensor_device_id('workplaceSensorDevice-id').patch(request_body)
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.