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)
Déléguée (compte professionnel ou scolaire)
DeviceManagementServiceConfig.ReadWrite.All
Déléguée (compte Microsoft personnel)
Non prise en charge.
Application
DeviceManagementServiceConfig.ReadWrite.All
Requête HTTP
POST /deviceManagement/termsAndConditions/{termsAndConditionsId}/acceptanceStatuses
POST https://graph.microsoft.com/v1.0/deviceManagement/termsAndConditions/{termsAndConditionsId}/acceptanceStatuses
Content-type: application/json
Content-length: 264
{
"@odata.type": "#microsoft.graph.termsAndConditionsAcceptanceStatus",
"userDisplayName": "User Display Name value",
"acceptedVersion": 15,
"acceptedDateTime": "2016-12-31T23:57:43.6165506-08:00",
"userPrincipalName": "User Principal Name value"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new TermsAndConditionsAcceptanceStatus
{
OdataType = "#microsoft.graph.termsAndConditionsAcceptanceStatus",
UserDisplayName = "User Display Name value",
AcceptedVersion = 15,
AcceptedDateTime = DateTimeOffset.Parse("2016-12-31T23:57:43.6165506-08:00"),
UserPrincipalName = "User Principal Name value",
};
// To initialize your graphClient, see https://zcusa.951200.xyz/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.DeviceManagement.TermsAndConditions["{termsAndConditions-id}"].AcceptanceStatuses.PostAsync(requestBody);
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
"time"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewTermsAndConditionsAcceptanceStatus()
userDisplayName := "User Display Name value"
requestBody.SetUserDisplayName(&userDisplayName)
acceptedVersion := int32(15)
requestBody.SetAcceptedVersion(&acceptedVersion)
acceptedDateTime , err := time.Parse(time.RFC3339, "2016-12-31T23:57:43.6165506-08:00")
requestBody.SetAcceptedDateTime(&acceptedDateTime)
userPrincipalName := "User Principal Name value"
requestBody.SetUserPrincipalName(&userPrincipalName)
// To initialize your graphClient, see https://zcusa.951200.xyz/en-us/graph/sdks/create-client?from=snippets&tabs=go
acceptanceStatuses, err := graphClient.DeviceManagement().TermsAndConditions().ByTermsAndConditionsId("termsAndConditions-id").AcceptanceStatuses().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
TermsAndConditionsAcceptanceStatus termsAndConditionsAcceptanceStatus = new TermsAndConditionsAcceptanceStatus();
termsAndConditionsAcceptanceStatus.setOdataType("#microsoft.graph.termsAndConditionsAcceptanceStatus");
termsAndConditionsAcceptanceStatus.setUserDisplayName("User Display Name value");
termsAndConditionsAcceptanceStatus.setAcceptedVersion(15);
OffsetDateTime acceptedDateTime = OffsetDateTime.parse("2016-12-31T23:57:43.6165506-08:00");
termsAndConditionsAcceptanceStatus.setAcceptedDateTime(acceptedDateTime);
termsAndConditionsAcceptanceStatus.setUserPrincipalName("User Principal Name value");
TermsAndConditionsAcceptanceStatus result = graphClient.deviceManagement().termsAndConditions().byTermsAndConditionsId("{termsAndConditions-id}").acceptanceStatuses().post(termsAndConditionsAcceptanceStatus);
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\TermsAndConditionsAcceptanceStatus;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new TermsAndConditionsAcceptanceStatus();
$requestBody->setOdataType('#microsoft.graph.termsAndConditionsAcceptanceStatus');
$requestBody->setUserDisplayName('User Display Name value');
$requestBody->setAcceptedVersion(15);
$requestBody->setAcceptedDateTime(new \DateTime('2016-12-31T23:57:43.6165506-08:00'));
$requestBody->setUserPrincipalName('User Principal Name value');
$result = $graphServiceClient->deviceManagement()->termsAndConditions()->byTermsAndConditionsId('termsAndConditions-id')->acceptanceStatuses()->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.terms_and_conditions_acceptance_status import TermsAndConditionsAcceptanceStatus
# To initialize your graph_client, see https://zcusa.951200.xyz/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = TermsAndConditionsAcceptanceStatus(
odata_type = "#microsoft.graph.termsAndConditionsAcceptanceStatus",
user_display_name = "User Display Name value",
accepted_version = 15,
accepted_date_time = "2016-12-31T23:57:43.6165506-08:00",
user_principal_name = "User Principal Name value",
)
result = await graph_client.device_management.terms_and_conditions.by_terms_and_conditions_id('termsAndConditions-id').acceptance_statuses.post(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 201 Created
Content-Type: application/json
Content-Length: 313
{
"@odata.type": "#microsoft.graph.termsAndConditionsAcceptanceStatus",
"id": "a045ce1a-ce1a-a045-1ace-45a01ace45a0",
"userDisplayName": "User Display Name value",
"acceptedVersion": 15,
"acceptedDateTime": "2016-12-31T23:57:43.6165506-08:00",
"userPrincipalName": "User Principal Name value"
}