PATCH https://graph.microsoft.com/v1.0/deviceManagement/deviceCompliancePolicySettingStateSummaries/{deviceCompliancePolicySettingStateSummaryId}/deviceComplianceSettingStates/{deviceComplianceSettingStateId}
Content-type: application/json
Content-length: 517
{
"@odata.type": "#microsoft.graph.deviceComplianceSettingState",
"setting": "Setting value",
"settingName": "Setting Name value",
"deviceId": "Device Id value",
"deviceName": "Device Name value",
"userId": "User Id value",
"userEmail": "User Email value",
"userName": "User Name value",
"userPrincipalName": "User Principal Name value",
"deviceModel": "Device Model value",
"state": "notApplicable",
"complianceGracePeriodExpirationDateTime": "2016-12-31T23:56:44.951111-08:00"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new DeviceComplianceSettingState
{
OdataType = "#microsoft.graph.deviceComplianceSettingState",
Setting = "Setting value",
SettingName = "Setting Name value",
DeviceId = "Device Id value",
DeviceName = "Device Name value",
UserId = "User Id value",
UserEmail = "User Email value",
UserName = "User Name value",
UserPrincipalName = "User Principal Name value",
DeviceModel = "Device Model value",
State = ComplianceStatus.NotApplicable,
ComplianceGracePeriodExpirationDateTime = DateTimeOffset.Parse("2016-12-31T23:56:44.951111-08:00"),
};
// To initialize your graphClient, see https://zcusa.951200.xyz/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.DeviceManagement.DeviceCompliancePolicySettingStateSummaries["{deviceCompliancePolicySettingStateSummary-id}"].DeviceComplianceSettingStates["{deviceComplianceSettingState-id}"].PatchAsync(requestBody);
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
"time"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewDeviceComplianceSettingState()
setting := "Setting value"
requestBody.SetSetting(&setting)
settingName := "Setting Name value"
requestBody.SetSettingName(&settingName)
deviceId := "Device Id value"
requestBody.SetDeviceId(&deviceId)
deviceName := "Device Name value"
requestBody.SetDeviceName(&deviceName)
userId := "User Id value"
requestBody.SetUserId(&userId)
userEmail := "User Email value"
requestBody.SetUserEmail(&userEmail)
userName := "User Name value"
requestBody.SetUserName(&userName)
userPrincipalName := "User Principal Name value"
requestBody.SetUserPrincipalName(&userPrincipalName)
deviceModel := "Device Model value"
requestBody.SetDeviceModel(&deviceModel)
state := graphmodels.NOTAPPLICABLE_COMPLIANCESTATUS
requestBody.SetState(&state)
complianceGracePeriodExpirationDateTime , err := time.Parse(time.RFC3339, "2016-12-31T23:56:44.951111-08:00")
requestBody.SetComplianceGracePeriodExpirationDateTime(&complianceGracePeriodExpirationDateTime)
// To initialize your graphClient, see https://zcusa.951200.xyz/en-us/graph/sdks/create-client?from=snippets&tabs=go
deviceComplianceSettingStates, err := graphClient.DeviceManagement().DeviceCompliancePolicySettingStateSummaries().ByDeviceCompliancePolicySettingStateSummaryId("deviceCompliancePolicySettingStateSummary-id").DeviceComplianceSettingStates().ByDeviceComplianceSettingStateId("deviceComplianceSettingState-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);
DeviceComplianceSettingState deviceComplianceSettingState = new DeviceComplianceSettingState();
deviceComplianceSettingState.setOdataType("#microsoft.graph.deviceComplianceSettingState");
deviceComplianceSettingState.setSetting("Setting value");
deviceComplianceSettingState.setSettingName("Setting Name value");
deviceComplianceSettingState.setDeviceId("Device Id value");
deviceComplianceSettingState.setDeviceName("Device Name value");
deviceComplianceSettingState.setUserId("User Id value");
deviceComplianceSettingState.setUserEmail("User Email value");
deviceComplianceSettingState.setUserName("User Name value");
deviceComplianceSettingState.setUserPrincipalName("User Principal Name value");
deviceComplianceSettingState.setDeviceModel("Device Model value");
deviceComplianceSettingState.setState(ComplianceStatus.NotApplicable);
OffsetDateTime complianceGracePeriodExpirationDateTime = OffsetDateTime.parse("2016-12-31T23:56:44.951111-08:00");
deviceComplianceSettingState.setComplianceGracePeriodExpirationDateTime(complianceGracePeriodExpirationDateTime);
DeviceComplianceSettingState result = graphClient.deviceManagement().deviceCompliancePolicySettingStateSummaries().byDeviceCompliancePolicySettingStateSummaryId("{deviceCompliancePolicySettingStateSummary-id}").deviceComplianceSettingStates().byDeviceComplianceSettingStateId("{deviceComplianceSettingState-id}").patch(deviceComplianceSettingState);
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\DeviceComplianceSettingState;
use Microsoft\Graph\Generated\Models\ComplianceStatus;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new DeviceComplianceSettingState();
$requestBody->setOdataType('#microsoft.graph.deviceComplianceSettingState');
$requestBody->setSetting('Setting value');
$requestBody->setSettingName('Setting Name value');
$requestBody->setDeviceId('Device Id value');
$requestBody->setDeviceName('Device Name value');
$requestBody->setUserId('User Id value');
$requestBody->setUserEmail('User Email value');
$requestBody->setUserName('User Name value');
$requestBody->setUserPrincipalName('User Principal Name value');
$requestBody->setDeviceModel('Device Model value');
$requestBody->setState(new ComplianceStatus('notApplicable'));
$requestBody->setComplianceGracePeriodExpirationDateTime(new \DateTime('2016-12-31T23:56:44.951111-08:00'));
$result = $graphServiceClient->deviceManagement()->deviceCompliancePolicySettingStateSummaries()->byDeviceCompliancePolicySettingStateSummaryId('deviceCompliancePolicySettingStateSummary-id')->deviceComplianceSettingStates()->byDeviceComplianceSettingStateId('deviceComplianceSettingState-id')->patch($requestBody)->wait();
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.device_compliance_setting_state import DeviceComplianceSettingState
from msgraph.generated.models.compliance_status import ComplianceStatus
# To initialize your graph_client, see https://zcusa.951200.xyz/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = DeviceComplianceSettingState(
odata_type = "#microsoft.graph.deviceComplianceSettingState",
setting = "Setting value",
setting_name = "Setting Name value",
device_id = "Device Id value",
device_name = "Device Name value",
user_id = "User Id value",
user_email = "User Email value",
user_name = "User Name value",
user_principal_name = "User Principal Name value",
device_model = "Device Model value",
state = ComplianceStatus.NotApplicable,
compliance_grace_period_expiration_date_time = "2016-12-31T23:56:44.951111-08:00",
)
result = await graph_client.device_management.device_compliance_policy_setting_state_summaries.by_device_compliance_policy_setting_state_summary_id('deviceCompliancePolicySettingStateSummary-id').device_compliance_setting_states.by_device_compliance_setting_state_id('deviceComplianceSettingState-id').patch(request_body)
Here is an example of the response. Note: The response object shown here may be truncated for brevity. All of the properties will be returned from an actual call.
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 566
{
"@odata.type": "#microsoft.graph.deviceComplianceSettingState",
"id": "9905f955-f955-9905-55f9-059955f90599",
"setting": "Setting value",
"settingName": "Setting Name value",
"deviceId": "Device Id value",
"deviceName": "Device Name value",
"userId": "User Id value",
"userEmail": "User Email value",
"userName": "User Name value",
"userPrincipalName": "User Principal Name value",
"deviceModel": "Device Model value",
"state": "notApplicable",
"complianceGracePeriodExpirationDateTime": "2016-12-31T23:56:44.951111-08:00"
}