In the request body, supply a JSON representation for the deviceComplianceScheduledActionForRule object.
The following table shows the properties that are required when you create the deviceComplianceScheduledActionForRule.
Property
Type
Description
id
String
Key of the entity.
ruleName
String
Name of the rule which this scheduled action applies to. Currently scheduled actions are created per policy instead of per rule, thus RuleName is always set to default value PasswordRequired.
POST https://graph.microsoft.com/v1.0/deviceManagement/deviceCompliancePolicies/{deviceCompliancePolicyId}/scheduledActionsForRule
Content-type: application/json
Content-length: 114
{
"@odata.type": "#microsoft.graph.deviceComplianceScheduledActionForRule",
"ruleName": "Rule Name value"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new DeviceComplianceScheduledActionForRule
{
OdataType = "#microsoft.graph.deviceComplianceScheduledActionForRule",
RuleName = "Rule 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.DeviceCompliancePolicies["{deviceCompliancePolicy-id}"].ScheduledActionsForRule.PostAsync(requestBody);
// THE CLI IS IN PREVIEW. NON-PRODUCTION USE ONLY
mgc device-management device-compliance-policies scheduled-actions-for-rule create --device-compliance-policy-id {deviceCompliancePolicy-id} --body '{\
"@odata.type": "#microsoft.graph.deviceComplianceScheduledActionForRule",\
"ruleName": "Rule Name value"\
}\
'
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
DeviceComplianceScheduledActionForRule deviceComplianceScheduledActionForRule = new DeviceComplianceScheduledActionForRule();
deviceComplianceScheduledActionForRule.setOdataType("#microsoft.graph.deviceComplianceScheduledActionForRule");
deviceComplianceScheduledActionForRule.setRuleName("Rule Name value");
DeviceComplianceScheduledActionForRule result = graphClient.deviceManagement().deviceCompliancePolicies().byDeviceCompliancePolicyId("{deviceCompliancePolicy-id}").scheduledActionsForRule().post(deviceComplianceScheduledActionForRule);
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\DeviceComplianceScheduledActionForRule;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new DeviceComplianceScheduledActionForRule();
$requestBody->setOdataType('#microsoft.graph.deviceComplianceScheduledActionForRule');
$requestBody->setRuleName('Rule Name value');
$result = $graphServiceClient->deviceManagement()->deviceCompliancePolicies()->byDeviceCompliancePolicyId('deviceCompliancePolicy-id')->scheduledActionsForRule()->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: 163
{
"@odata.type": "#microsoft.graph.deviceComplianceScheduledActionForRule",
"id": "f0075d5e-5d5e-f007-5e5d-07f05e5d07f0",
"ruleName": "Rule 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.