Compliance status of the policy report. Possible values are: unknown, notApplicable, compliant, remediated, nonCompliant, error, conflict, notAssigned.
lastReportedDateTime
DateTimeOffset
Last modified date time of the policy report.
userPrincipalName
String
UserPrincipalName.
Response
If successful, this method returns a 201 Created response code and a deviceConfigurationDeviceStatus object in the response body.
POST https://graph.microsoft.com/v1.0/deviceManagement/deviceConfigurations/{deviceConfigurationId}/deviceStatuses
Content-type: application/json
Content-length: 429
{
"@odata.type": "#microsoft.graph.deviceConfigurationDeviceStatus",
"deviceDisplayName": "Device Display Name value",
"userName": "User Name value",
"deviceModel": "Device Model value",
"complianceGracePeriodExpirationDateTime": "2016-12-31T23:56:44.951111-08:00",
"status": "notApplicable",
"lastReportedDateTime": "2017-01-01T00:00:17.7769392-08:00",
"userPrincipalName": "User Principal Name value"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new DeviceConfigurationDeviceStatus
{
OdataType = "#microsoft.graph.deviceConfigurationDeviceStatus",
DeviceDisplayName = "Device Display Name value",
UserName = "User Name value",
DeviceModel = "Device Model value",
ComplianceGracePeriodExpirationDateTime = DateTimeOffset.Parse("2016-12-31T23:56:44.951111-08:00"),
Status = ComplianceStatus.NotApplicable,
LastReportedDateTime = DateTimeOffset.Parse("2017-01-01T00:00:17.7769392-08:00"),
UserPrincipalName = "User Principal Name value",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.DeviceManagement.DeviceConfigurations["{deviceConfiguration-id}"].DeviceStatuses.PostAsync(requestBody);
// THE CLI IS IN PREVIEW. NON-PRODUCTION USE ONLY
mgc device-management device-configurations device-statuses create --device-configuration-id {deviceConfiguration-id} --body '{\
"@odata.type": "#microsoft.graph.deviceConfigurationDeviceStatus",\
"deviceDisplayName": "Device Display Name value",\
"userName": "User Name value",\
"deviceModel": "Device Model value",\
"complianceGracePeriodExpirationDateTime": "2016-12-31T23:56:44.951111-08:00",\
"status": "notApplicable",\
"lastReportedDateTime": "2017-01-01T00:00:17.7769392-08:00",\
"userPrincipalName": "User Principal Name value"\
}\
'
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
DeviceConfigurationDeviceStatus deviceConfigurationDeviceStatus = new DeviceConfigurationDeviceStatus();
deviceConfigurationDeviceStatus.setOdataType("#microsoft.graph.deviceConfigurationDeviceStatus");
deviceConfigurationDeviceStatus.setDeviceDisplayName("Device Display Name value");
deviceConfigurationDeviceStatus.setUserName("User Name value");
deviceConfigurationDeviceStatus.setDeviceModel("Device Model value");
OffsetDateTime complianceGracePeriodExpirationDateTime = OffsetDateTime.parse("2016-12-31T23:56:44.951111-08:00");
deviceConfigurationDeviceStatus.setComplianceGracePeriodExpirationDateTime(complianceGracePeriodExpirationDateTime);
deviceConfigurationDeviceStatus.setStatus(ComplianceStatus.NotApplicable);
OffsetDateTime lastReportedDateTime = OffsetDateTime.parse("2017-01-01T00:00:17.7769392-08:00");
deviceConfigurationDeviceStatus.setLastReportedDateTime(lastReportedDateTime);
deviceConfigurationDeviceStatus.setUserPrincipalName("User Principal Name value");
DeviceConfigurationDeviceStatus result = graphClient.deviceManagement().deviceConfigurations().byDeviceConfigurationId("{deviceConfiguration-id}").deviceStatuses().post(deviceConfigurationDeviceStatus);
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\DeviceConfigurationDeviceStatus;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new DeviceConfigurationDeviceStatus();
$requestBody->setOdataType('#microsoft.graph.deviceConfigurationDeviceStatus');
$requestBody->setDeviceDisplayName('Device Display Name value');
$requestBody->setUserName('User Name value');
$requestBody->setDeviceModel('Device Model value');
$requestBody->setComplianceGracePeriodExpirationDateTime(new \DateTime('2016-12-31T23:56:44.951111-08:00'));
$requestBody->setStatus(new ComplianceStatus('notApplicable'));
$requestBody->setLastReportedDateTime(new \DateTime('2017-01-01T00:00:17.7769392-08:00'));
$requestBody->setUserPrincipalName('User Principal Name value');
$result = $graphServiceClient->deviceManagement()->deviceConfigurations()->byDeviceConfigurationId('deviceConfiguration-id')->deviceStatuses()->post($requestBody)->wait();
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 201 Created
Content-Type: application/json
Content-Length: 478
{
"@odata.type": "#microsoft.graph.deviceConfigurationDeviceStatus",
"id": "674e98e5-98e5-674e-e598-4e67e5984e67",
"deviceDisplayName": "Device Display Name value",
"userName": "User Name value",
"deviceModel": "Device Model value",
"complianceGracePeriodExpirationDateTime": "2016-12-31T23:56:44.951111-08:00",
"status": "notApplicable",
"lastReportedDateTime": "2017-01-01T00:00:17.7769392-08:00",
"userPrincipalName": "User Principal Name value"
}
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see: https://aka.ms/ContentUserFeedback.