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)
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new DeviceManagement
{
OdataType = "#microsoft.graph.deviceManagement",
Settings = new DeviceManagementSettings
{
OdataType = "microsoft.graph.deviceManagementSettings",
DeviceComplianceCheckinThresholdDays = 4,
IsScheduledActionEnabled = true,
SecureByDefault = true,
},
IntuneAccountId = Guid.Parse("cf1549a1-49a1-cf15-a149-15cfa14915cf"),
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.DeviceManagement.PatchAsync(requestBody);
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
"github.com/google/uuid"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewDeviceManagement()
settings := graphmodels.NewDeviceManagementSettings()
deviceComplianceCheckinThresholdDays := int32(4)
settings.SetDeviceComplianceCheckinThresholdDays(&deviceComplianceCheckinThresholdDays)
isScheduledActionEnabled := true
settings.SetIsScheduledActionEnabled(&isScheduledActionEnabled)
secureByDefault := true
settings.SetSecureByDefault(&secureByDefault)
requestBody.SetSettings(settings)
intuneAccountId := uuid.MustParse("cf1549a1-49a1-cf15-a149-15cfa14915cf")
requestBody.SetIntuneAccountId(&intuneAccountId)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
deviceManagement, err := graphClient.DeviceManagement().Patch(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
DeviceManagement deviceManagement = new DeviceManagement();
deviceManagement.setOdataType("#microsoft.graph.deviceManagement");
DeviceManagementSettings settings = new DeviceManagementSettings();
settings.setOdataType("microsoft.graph.deviceManagementSettings");
settings.setDeviceComplianceCheckinThresholdDays(4);
settings.setIsScheduledActionEnabled(true);
settings.setSecureByDefault(true);
deviceManagement.setSettings(settings);
deviceManagement.setIntuneAccountId(UUID.fromString("cf1549a1-49a1-cf15-a149-15cfa14915cf"));
DeviceManagement result = graphClient.deviceManagement().patch(deviceManagement);
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\DeviceManagement;
use Microsoft\Graph\Generated\Models\DeviceManagementSettings;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new DeviceManagement();
$requestBody->setOdataType('#microsoft.graph.deviceManagement');
$settings = new DeviceManagementSettings();
$settings->setOdataType('microsoft.graph.deviceManagementSettings');
$settings->setDeviceComplianceCheckinThresholdDays(4);
$settings->setIsScheduledActionEnabled(true);
$settings->setSecureByDefault(true);
$requestBody->setSettings($settings);
$requestBody->setIntuneAccountId('cf1549a1-49a1-cf15-a149-15cfa14915cf');
$result = $graphServiceClient->deviceManagement()->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_management import DeviceManagement
from msgraph.generated.models.device_management_settings import DeviceManagementSettings
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = DeviceManagement(
odata_type = "#microsoft.graph.deviceManagement",
settings = DeviceManagementSettings(
odata_type = "microsoft.graph.deviceManagementSettings",
device_compliance_checkin_threshold_days = 4,
is_scheduled_action_enabled = True,
secure_by_default = True,
),
intune_account_id = UUID("cf1549a1-49a1-cf15-a149-15cfa14915cf"),
)
result = await graph_client.device_management.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.