创建 deviceComplianceSettingStateCreate deviceComplianceSettingState

命名空间:microsoft.graphNamespace: microsoft.graph

注意: 适用于 Intune 的 Microsoft Graph API 需要适用于租户的活动 Intune 许可证Note: The Microsoft Graph API for Intune requires an active Intune license for the tenant.

创建新的 deviceComplianceSettingState 对象。Create a new deviceComplianceSettingState object.

先决条件Prerequisites

要调用此 API,需要以下权限之一。要了解详细信息,包括如何选择权限的信息,请参阅权限One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.

权限类型Permission type 权限(从最高特权到最低特权)Permissions (from most to least privileged)
委派(工作或学校帐户)Delegated (work or school account) DeviceManagementConfiguration.ReadWrite.AllDeviceManagementConfiguration.ReadWrite.All
委派(个人 Microsoft 帐户)Delegated (personal Microsoft account) 不支持。Not supported.
应用程序Application 不支持。Not supported.

HTTP 请求HTTP Request

POST /deviceManagement/deviceCompliancePolicySettingStateSummaries/{deviceCompliancePolicySettingStateSummaryId}/deviceComplianceSettingStates

请求标头Request headers

标头Header Value
AuthorizationAuthorization Bearer <token>。必需。Bearer <token> Required.
接受Accept application/jsonapplication/json

请求正文Request body

在请求正文中,提供 deviceComplianceSettingState 对象的 JSON 表示形式。In the request body, supply a JSON representation for the deviceComplianceSettingState object.

下表显示了创建 deviceComplianceSettingState 时所需的属性。The following table shows the properties that are required when you create the deviceComplianceSettingState.

属性Property 类型Type 说明Description
idid StringString 实体的键Key of the entity
settingsetting StringString 设置类名和属性名。The setting class name and property name.
settingNamesettingName StringString 报告的设置名称The Setting Name that is being reported
deviceIddeviceId StringString 报告的设备 IDThe Device Id that is being reported
deviceNamedeviceName StringString 报告的设备名称The Device Name that is being reported
userIduserId StringString 报告的用户 IDThe user Id that is being reported
userEmailuserEmail StringString 报告的用户电子邮件地址The User email address that is being reported
userNameuserName StringString 报告的用户名The User Name that is being reported
userPrincipalNameuserPrincipalName StringString 报告的用户主体名称The User PrincipalName that is being reported
deviceModeldeviceModel StringString 报告的设备模型The device model that is being reported
statestate complianceStatuscomplianceStatus 设置的符合性状态。The compliance state of the setting. 可取值为:unknownnotApplicablecompliantremediatednonComplianterrorconflictnotAssignedPossible values are: unknown, notApplicable, compliant, remediated, nonCompliant, error, conflict, notAssigned.
complianceGracePeriodExpirationDateTimecomplianceGracePeriodExpirationDateTime DateTimeOffsetDateTimeOffset 设备符合性宽限期的到期日期/时间The DateTime when device compliance grace period expires

响应Response

如果成功,此方法在响应正文中返回 201 Created 响应代码和 deviceComplianceSettingState 对象。If successful, this method returns a 201 Created response code and a deviceComplianceSettingState object in the response body.

示例Example

请求Request

下面是一个请求示例。Here is an example of the request.

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"
}

响应Response

下面是一个响应示例。注意:为了简单起见,可能会将此处所示的响应对象截断。将从实际调用中返回所有属性。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: 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"
}