POST /deviceManagement/deviceCompliancePolicies/{deviceCompliancePolicyId}/scheduledActionsForRule/{deviceComplianceScheduledActionForRuleId}/scheduledActionConfigurations
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new DeviceComplianceActionItem
{
OdataType = "#microsoft.graph.deviceComplianceActionItem",
GracePeriodHours = 0,
ActionType = DeviceComplianceActionType.Notification,
NotificationTemplateId = "Notification Template Id value",
NotificationMessageCCList = new List<string>
{
"Notification Message CCList 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["{deviceComplianceScheduledActionForRule-id}"].ScheduledActionConfigurations.PostAsync(requestBody);
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewDeviceComplianceActionItem()
gracePeriodHours := int32(0)
requestBody.SetGracePeriodHours(&gracePeriodHours)
actionType := graphmodels.NOTIFICATION_DEVICECOMPLIANCEACTIONTYPE
requestBody.SetActionType(&actionType)
notificationTemplateId := "Notification Template Id value"
requestBody.SetNotificationTemplateId(¬ificationTemplateId)
notificationMessageCCList := []string {
"Notification Message CCList value",
}
requestBody.SetNotificationMessageCCList(notificationMessageCCList)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
scheduledActionConfigurations, err := graphClient.DeviceManagement().DeviceCompliancePolicies().ByDeviceCompliancePolicyId("deviceCompliancePolicy-id").ScheduledActionsForRule().ByDeviceComplianceScheduledActionForRuleId("deviceComplianceScheduledActionForRule-id").ScheduledActionConfigurations().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
DeviceComplianceActionItem deviceComplianceActionItem = new DeviceComplianceActionItem();
deviceComplianceActionItem.setOdataType("#microsoft.graph.deviceComplianceActionItem");
deviceComplianceActionItem.setGracePeriodHours(0);
deviceComplianceActionItem.setActionType(DeviceComplianceActionType.Notification);
deviceComplianceActionItem.setNotificationTemplateId("Notification Template Id value");
LinkedList<String> notificationMessageCCList = new LinkedList<String>();
notificationMessageCCList.add("Notification Message CCList value");
deviceComplianceActionItem.setNotificationMessageCCList(notificationMessageCCList);
DeviceComplianceActionItem result = graphClient.deviceManagement().deviceCompliancePolicies().byDeviceCompliancePolicyId("{deviceCompliancePolicy-id}").scheduledActionsForRule().byDeviceComplianceScheduledActionForRuleId("{deviceComplianceScheduledActionForRule-id}").scheduledActionConfigurations().post(deviceComplianceActionItem);
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.device_compliance_action_item import DeviceComplianceActionItem
from msgraph.generated.models.device_compliance_action_type import DeviceComplianceActionType
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = DeviceComplianceActionItem(
odata_type = "#microsoft.graph.deviceComplianceActionItem",
grace_period_hours = 0,
action_type = DeviceComplianceActionType.Notification,
notification_template_id = "Notification Template Id value",
notification_message_c_c_list = [
"Notification Message CCList value",
],
)
result = await graph_client.device_management.device_compliance_policies.by_device_compliance_policy_id('deviceCompliancePolicy-id').scheduled_actions_for_rule.by_device_compliance_scheduled_action_for_rule_id('deviceComplianceScheduledActionForRule-id').scheduled_action_configurations.post(request_body)