Les API sous la version /beta dans Microsoft Graph sont susceptibles d’être modifiées. L’utilisation de ces API dans des applications de production n’est pas prise en charge. Pour déterminer si une API est disponible dans v1.0, utilisez le sélecteur Version .
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)
eDiscovery.Read.All, eDiscovery.ReadWrite.All
Déléguée (compte Microsoft personnel)
Non prise en charge.
Application
Non prise en charge.
Requête HTTP
POST /compliance/ediscovery/cases/{caseId}/legalHolds
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models.Ediscovery;
using Microsoft.Graph.Beta.Models;
var requestBody = new LegalHold
{
OdataType = "#microsoft.graph.ediscovery.legalHold",
Description = "String",
CreatedBy = new IdentitySet
{
OdataType = "microsoft.graph.identitySet",
},
IsEnabled = boolean,
Status = LegalHoldStatus.Pending,
ContentQuery = "String",
Errors = new List<string>
{
"String",
},
DisplayName = "String",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Compliance.Ediscovery.Cases["{case-id}"].LegalHolds.PostAsync(requestBody);
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.beta.models.ediscovery.LegalHold legalHold = new com.microsoft.graph.beta.models.ediscovery.LegalHold();
legalHold.setOdataType("#microsoft.graph.ediscovery.legalHold");
legalHold.setDescription("String");
IdentitySet createdBy = new IdentitySet();
createdBy.setOdataType("microsoft.graph.identitySet");
legalHold.setCreatedBy(createdBy);
legalHold.setIsEnabled(boolean);
legalHold.setStatus(com.microsoft.graph.beta.models.ediscovery.LegalHoldStatus.Pending);
legalHold.setContentQuery("String");
LinkedList<String> errors = new LinkedList<String>();
errors.add("String");
legalHold.setErrors(errors);
legalHold.setDisplayName("String");
com.microsoft.graph.models.ediscovery.LegalHold result = graphClient.compliance().ediscovery().cases().byCaseId("{case-id}").legalHolds().post(legalHold);
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.ediscovery.legal_hold import LegalHold
from msgraph_beta.generated.models.identity_set import IdentitySet
from msgraph_beta.generated.models.legal_hold_status import LegalHoldStatus
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = LegalHold(
odata_type = "#microsoft.graph.ediscovery.legalHold",
description = "String",
created_by = IdentitySet(
odata_type = "microsoft.graph.identitySet",
),
is_enabled = Boolean,
status = LegalHoldStatus.Pending,
content_query = "String",
errors = [
"String",
],
display_name = "String",
)
result = await graph_client.compliance.ediscovery.cases.by_case_id('case-id').legal_holds.post(request_body)