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 .
Représente la charge de travail (SharePoint Online, OneDrive Entreprise, Exchange Online) et les informations d’identification associées à un événement de rétention.
eventTriggerDateTime
DateTimeOffset
Heure facultative à laquelle l’événement doit être déclenché.
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models.Security;
using Microsoft.Graph.Beta.Models;
var requestBody = new RetentionEvent
{
OdataType = "#microsoft.graph.security.retentionEvent",
DisplayName = "String",
Description = "String",
EventQueries = new List<EventQuery>
{
new EventQuery
{
OdataType = "microsoft.graph.security.eventQuery",
},
},
EventTriggerDateTime = DateTimeOffset.Parse("String (timestamp)"),
CreatedBy = new IdentitySet
{
OdataType = "microsoft.graph.identitySet",
},
EventPropagationResults = new List<EventPropagationResult>
{
new EventPropagationResult
{
OdataType = "microsoft.graph.security.eventPropagationResult",
},
},
EventStatus = new RetentionEventStatus
{
OdataType = "microsoft.graph.security.retentionEventStatus",
},
LastStatusUpdateDateTime = DateTimeOffset.Parse("String (timestamp)"),
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Security.Triggers.RetentionEvents.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.security.RetentionEvent retentionEvent = new com.microsoft.graph.beta.models.security.RetentionEvent();
retentionEvent.setOdataType("#microsoft.graph.security.retentionEvent");
retentionEvent.setDisplayName("String");
retentionEvent.setDescription("String");
LinkedList<com.microsoft.graph.beta.models.security.EventQuery> eventQueries = new LinkedList<com.microsoft.graph.beta.models.security.EventQuery>();
com.microsoft.graph.beta.models.security.EventQuery eventQuery = new com.microsoft.graph.beta.models.security.EventQuery();
eventQuery.setOdataType("microsoft.graph.security.eventQuery");
eventQueries.add(eventQuery);
retentionEvent.setEventQueries(eventQueries);
OffsetDateTime eventTriggerDateTime = OffsetDateTime.parse("String (timestamp)");
retentionEvent.setEventTriggerDateTime(eventTriggerDateTime);
IdentitySet createdBy = new IdentitySet();
createdBy.setOdataType("microsoft.graph.identitySet");
retentionEvent.setCreatedBy(createdBy);
LinkedList<com.microsoft.graph.beta.models.security.EventPropagationResult> eventPropagationResults = new LinkedList<com.microsoft.graph.beta.models.security.EventPropagationResult>();
com.microsoft.graph.beta.models.security.EventPropagationResult eventPropagationResult = new com.microsoft.graph.beta.models.security.EventPropagationResult();
eventPropagationResult.setOdataType("microsoft.graph.security.eventPropagationResult");
eventPropagationResults.add(eventPropagationResult);
retentionEvent.setEventPropagationResults(eventPropagationResults);
com.microsoft.graph.beta.models.security.RetentionEventStatus eventStatus = new com.microsoft.graph.beta.models.security.RetentionEventStatus();
eventStatus.setOdataType("microsoft.graph.security.retentionEventStatus");
retentionEvent.setEventStatus(eventStatus);
OffsetDateTime lastStatusUpdateDateTime = OffsetDateTime.parse("String (timestamp)");
retentionEvent.setLastStatusUpdateDateTime(lastStatusUpdateDateTime);
com.microsoft.graph.models.security.RetentionEvent result = graphClient.security().triggers().retentionEvents().post(retentionEvent);