L’une des autorisations suivantes est nécessaire pour appeler cette API. Pour plus d’informations, notamment sur la façon de choisir les autorisations, voir Autorisations.
Type d’autorisation
Autorisations (de celle qui offre le plus de privilèges à celle qui en offre le moins)
Nom de la règle à laquelle s’applique cette action programmée. Actuellement, les actions planifiées sont créées par stratégie et non par règle. Par conséquent, RuleName est toujours défini sur la valeur par défaut PasswordRequired.
Réponse
Si elle réussit, cette méthode renvoie un code de réponse 200 OK et l’objet deviceComplianceScheduledActionForRule mis à jour dans le corps de la réponse.
// 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["{deviceComplianceScheduledActionForRule-id}"].PatchAsync(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().ByDeviceComplianceScheduledActionForRuleId("deviceComplianceScheduledActionForRule-id").Patch(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().byDeviceComplianceScheduledActionForRuleId("{deviceComplianceScheduledActionForRule-id}").patch(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()->byDeviceComplianceScheduledActionForRuleId('deviceComplianceScheduledActionForRule-id')->patch($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.by_device_compliance_scheduled_action_for_rule_id('deviceComplianceScheduledActionForRule-id').patch(request_body)
Voici un exemple de réponse. Remarque : l’objet de réponse illustré ici peut être tronqué à des fins de concision. Toutes les propriétés sont renvoyées à partir d’un appel réel.
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 163
{
"@odata.type": "#microsoft.graph.deviceComplianceScheduledActionForRule",
"id": "f0075d5e-5d5e-f007-5e5d-07f05e5d07f0",
"ruleName": "Rule Name value"
}