L’une des autorisations suivantes est nécessaire pour appeler cette API. Pour plus d’informations, notamment sur la façon de choisir les autorisations, voir Autorisations.
Type d’autorisation
Autorisations (de celle qui offre le plus de privilèges à celle qui en offre le moins)
Déléguée (compte professionnel ou scolaire)
DeviceManagementConfiguration.ReadWrite.All
Déléguée (compte Microsoft personnel)
Non prise en charge.
Application
DeviceManagementConfiguration.ReadWrite.All
Requête HTTP
POST /deviceManagement/deviceCompliancePolicySettingStateSummaries/{deviceCompliancePolicySettingStateSummaryId}/deviceComplianceSettingStates
État de conformité du paramètre. Les valeurs possibles sont les suivantes : unknown, notApplicable, compliant, remediated, nonCompliant, error, conflict et notAssigned.
complianceGracePeriodExpirationDateTime
DateTimeOffset
Date et heure d’expiration de la période de grâce de conformité de l’appareil
Réponse
Si elle réussit, cette méthode renvoie un code de réponse 201 Created et un objet deviceComplianceSettingState dans le corps de la réponse.
POST https://graph.microsoft.com/v1.0/deviceManagement/deviceCompliancePolicySettingStateSummaries/{deviceCompliancePolicySettingStateSummaryId}/deviceComplianceSettingStates
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://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.DeviceManagement.DeviceCompliancePolicySettingStateSummaries["{deviceCompliancePolicySettingStateSummary-id}"].DeviceComplianceSettingStates.PostAsync(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://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
deviceComplianceSettingStates, err := graphClient.DeviceManagement().DeviceCompliancePolicySettingStateSummaries().ByDeviceCompliancePolicySettingStateSummaryId("deviceCompliancePolicySettingStateSummary-id").DeviceComplianceSettingStates().Post(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().post(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()->post($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://learn.microsoft.com/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.post(request_body)
Voici un exemple de réponse. Remarque : l’objet de réponse illustré ici peut être tronqué à des fins de concision. Toutes les propriétés sont renvoyées à partir d’un appel réel.
HTTP/1.1 201 Created
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"
}