POST https://graph.microsoft.com/v1.0/deviceManagement/deviceCompliancePolicies
Content-type: application/json
Content-length: 607
{
"@odata.type": "#microsoft.graph.windowsPhone81CompliancePolicy",
"description": "Description value",
"displayName": "Display Name value",
"version": 7,
"passwordBlockSimple": true,
"passwordExpirationDays": 6,
"passwordMinimumLength": 5,
"passwordMinutesOfInactivityBeforeLock": 5,
"passwordMinimumCharacterSetCount": 0,
"passwordRequiredType": "alphanumeric",
"passwordPreviousPasswordBlockCount": 2,
"passwordRequired": true,
"osMinimumVersion": "Os Minimum Version value",
"osMaximumVersion": "Os Maximum Version value",
"storageRequireEncryption": true
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new WindowsPhone81CompliancePolicy
{
OdataType = "#microsoft.graph.windowsPhone81CompliancePolicy",
Description = "Description value",
DisplayName = "Display Name value",
Version = 7,
PasswordBlockSimple = true,
PasswordExpirationDays = 6,
PasswordMinimumLength = 5,
PasswordMinutesOfInactivityBeforeLock = 5,
PasswordMinimumCharacterSetCount = 0,
PasswordRequiredType = RequiredPasswordType.Alphanumeric,
PasswordPreviousPasswordBlockCount = 2,
PasswordRequired = true,
OsMinimumVersion = "Os Minimum Version value",
OsMaximumVersion = "Os Maximum Version value",
StorageRequireEncryption = true,
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.DeviceManagement.DeviceCompliancePolicies.PostAsync(requestBody);
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
WindowsPhone81CompliancePolicy deviceCompliancePolicy = new WindowsPhone81CompliancePolicy();
deviceCompliancePolicy.setOdataType("#microsoft.graph.windowsPhone81CompliancePolicy");
deviceCompliancePolicy.setDescription("Description value");
deviceCompliancePolicy.setDisplayName("Display Name value");
deviceCompliancePolicy.setVersion(7);
deviceCompliancePolicy.setPasswordBlockSimple(true);
deviceCompliancePolicy.setPasswordExpirationDays(6);
deviceCompliancePolicy.setPasswordMinimumLength(5);
deviceCompliancePolicy.setPasswordMinutesOfInactivityBeforeLock(5);
deviceCompliancePolicy.setPasswordMinimumCharacterSetCount(0);
deviceCompliancePolicy.setPasswordRequiredType(RequiredPasswordType.Alphanumeric);
deviceCompliancePolicy.setPasswordPreviousPasswordBlockCount(2);
deviceCompliancePolicy.setPasswordRequired(true);
deviceCompliancePolicy.setOsMinimumVersion("Os Minimum Version value");
deviceCompliancePolicy.setOsMaximumVersion("Os Maximum Version value");
deviceCompliancePolicy.setStorageRequireEncryption(true);
DeviceCompliancePolicy result = graphClient.deviceManagement().deviceCompliancePolicies().post(deviceCompliancePolicy);
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\WindowsPhone81CompliancePolicy;
use Microsoft\Graph\Generated\Models\RequiredPasswordType;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new WindowsPhone81CompliancePolicy();
$requestBody->setOdataType('#microsoft.graph.windowsPhone81CompliancePolicy');
$requestBody->setDescription('Description value');
$requestBody->setDisplayName('Display Name value');
$requestBody->setVersion(7);
$requestBody->setPasswordBlockSimple(true);
$requestBody->setPasswordExpirationDays(6);
$requestBody->setPasswordMinimumLength(5);
$requestBody->setPasswordMinutesOfInactivityBeforeLock(5);
$requestBody->setPasswordMinimumCharacterSetCount(0);
$requestBody->setPasswordRequiredType(new RequiredPasswordType('alphanumeric'));
$requestBody->setPasswordPreviousPasswordBlockCount(2);
$requestBody->setPasswordRequired(true);
$requestBody->setOsMinimumVersion('Os Minimum Version value');
$requestBody->setOsMaximumVersion('Os Maximum Version value');
$requestBody->setStorageRequireEncryption(true);
$result = $graphServiceClient->deviceManagement()->deviceCompliancePolicies()->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.windows_phone81_compliance_policy import WindowsPhone81CompliancePolicy
from msgraph.generated.models.required_password_type import RequiredPasswordType
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = WindowsPhone81CompliancePolicy(
odata_type = "#microsoft.graph.windowsPhone81CompliancePolicy",
description = "Description value",
display_name = "Display Name value",
version = 7,
password_block_simple = True,
password_expiration_days = 6,
password_minimum_length = 5,
password_minutes_of_inactivity_before_lock = 5,
password_minimum_character_set_count = 0,
password_required_type = RequiredPasswordType.Alphanumeric,
password_previous_password_block_count = 2,
password_required = True,
os_minimum_version = "Os Minimum Version value",
os_maximum_version = "Os Maximum Version value",
storage_require_encryption = True,
)
result = await graph_client.device_management.device_compliance_policies.post(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.