Dans le corps de la demande, fournissez une représentation JSON de l’objet cloudPcUserSetting .
Le tableau suivant répertorie les propriétés qui sont requises lorsque vous créez le cloudPcUserSetting.
Propriété
Type
Description
displayName
Chaîne
Nom du paramètre tel qu’il apparaît dans l’interface utilisateur.
lastModifiedDateTime
DateTimeOffset
Date et heure de la dernière modification du paramètre. Le type d’horodatage représente les informations de date et d’heure au format ISO 8601 et est toujours au format UTC. Par exemple, le 1er janvier 2014 à minuit UTC se présente comme suit : 2014-01-01T00:00:00Z.
localAdminEnabled
Valeur booléenne
Pour activer l’option d’administrateur local, remplacez ce paramètre par true.
Définit la fréquence à laquelle un point de restauration est créé (autrement dit, une instantané est effectuée) pour les PC cloud provisionnés des utilisateurs (la valeur par défaut est de 12 heures) et si l’utilisateur est autorisé à restaurer ses propres PC cloud sur une sauvegarde effectuée à un moment spécifique dans le temps.
Réponse
Si elle réussit, cette méthode renvoie un 201 Created code de réponse et un objet cloudPcUserSetting 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 CloudPcUserSetting
{
OdataType = "#microsoft.graph.cloudPcUserSetting",
DisplayName = "Example",
LocalAdminEnabled = true,
RestorePointSetting = new CloudPcRestorePointSetting
{
FrequencyType = CloudPcRestorePointFrequencyType.SixteenHours,
UserRestoreEnabled = true,
},
};
// To initialize your graphClient, see https://video2.skills-academy.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.DeviceManagement.VirtualEndpoint.UserSettings.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.NewCloudPcUserSetting()
displayName := "Example"
requestBody.SetDisplayName(&displayName)
localAdminEnabled := true
requestBody.SetLocalAdminEnabled(&localAdminEnabled)
restorePointSetting := graphmodels.NewCloudPcRestorePointSetting()
frequencyType := graphmodels.SIXTEENHOURS_CLOUDPCRESTOREPOINTFREQUENCYTYPE
restorePointSetting.SetFrequencyType(&frequencyType)
userRestoreEnabled := true
restorePointSetting.SetUserRestoreEnabled(&userRestoreEnabled)
requestBody.SetRestorePointSetting(restorePointSetting)
// To initialize your graphClient, see https://video2.skills-academy.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
userSettings, err := graphClient.DeviceManagement().VirtualEndpoint().UserSettings().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
CloudPcUserSetting cloudPcUserSetting = new CloudPcUserSetting();
cloudPcUserSetting.setOdataType("#microsoft.graph.cloudPcUserSetting");
cloudPcUserSetting.setDisplayName("Example");
cloudPcUserSetting.setLocalAdminEnabled(true);
CloudPcRestorePointSetting restorePointSetting = new CloudPcRestorePointSetting();
restorePointSetting.setFrequencyType(CloudPcRestorePointFrequencyType.SixteenHours);
restorePointSetting.setUserRestoreEnabled(true);
cloudPcUserSetting.setRestorePointSetting(restorePointSetting);
CloudPcUserSetting result = graphClient.deviceManagement().virtualEndpoint().userSettings().post(cloudPcUserSetting);
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\CloudPcUserSetting;
use Microsoft\Graph\Generated\Models\CloudPcRestorePointSetting;
use Microsoft\Graph\Generated\Models\CloudPcRestorePointFrequencyType;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new CloudPcUserSetting();
$requestBody->setOdataType('#microsoft.graph.cloudPcUserSetting');
$requestBody->setDisplayName('Example');
$requestBody->setLocalAdminEnabled(true);
$restorePointSetting = new CloudPcRestorePointSetting();
$restorePointSetting->setFrequencyType(new CloudPcRestorePointFrequencyType('sixteenHours'));
$restorePointSetting->setUserRestoreEnabled(true);
$requestBody->setRestorePointSetting($restorePointSetting);
$result = $graphServiceClient->deviceManagement()->virtualEndpoint()->userSettings()->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.cloud_pc_user_setting import CloudPcUserSetting
from msgraph.generated.models.cloud_pc_restore_point_setting import CloudPcRestorePointSetting
from msgraph.generated.models.cloud_pc_restore_point_frequency_type import CloudPcRestorePointFrequencyType
# To initialize your graph_client, see https://video2.skills-academy.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = CloudPcUserSetting(
odata_type = "#microsoft.graph.cloudPcUserSetting",
display_name = "Example",
local_admin_enabled = True,
restore_point_setting = CloudPcRestorePointSetting(
frequency_type = CloudPcRestorePointFrequencyType.SixteenHours,
user_restore_enabled = True,
),
)
result = await graph_client.device_management.virtual_endpoint.user_settings.post(request_body)