En el cuerpo de la solicitud, especifique una representación JSON del objeto deviceComplianceScheduledActionForRule.
En la tabla siguiente se muestran las propiedades necesarias para crear el objeto deviceComplianceScheduledActionForRule.
Propiedad
Tipo
Descripción
id
Cadena
Clave de la entidad.
ruleName
String
Nombre de la regla a la que se aplica esta acción programada. Las acciones programadas actualmente se crean por directiva en lugar de por regla, por lo que RuleName siempre se establece en el valor predeterminado PasswordRequired.
Respuesta
Si se ejecuta correctamente, este método devuelve un código de respuesta 201 Created y un objeto deviceComplianceScheduledActionForRule en el cuerpo de la respuesta.
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);
// 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.NewDeviceComplianceScheduledActionForRule()
ruleName := "Rule Name value"
requestBody.SetRuleName(&ruleName)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
scheduledActionsForRule, err := graphClient.DeviceManagement().DeviceCompliancePolicies().ByDeviceCompliancePolicyId("deviceCompliancePolicy-id").ScheduledActionsForRule().Post(context.Background(), requestBody, nil)
// 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();
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.device_compliance_scheduled_action_for_rule import DeviceComplianceScheduledActionForRule
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = DeviceComplianceScheduledActionForRule(
odata_type = "#microsoft.graph.deviceComplianceScheduledActionForRule",
rule_name = "Rule Name value",
)
result = await graph_client.device_management.device_compliance_policies.by_device_compliance_policy_id('deviceCompliancePolicy-id').scheduled_actions_for_rule.post(request_body)
Aquí tiene un ejemplo de la respuesta. Nota: Es posible que el objeto de respuesta que aparezca aquí esté truncado para abreviar. Todas las propiedades se devolverán desde una llamada real.
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"
}