APIs under the /beta version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.
Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.
// 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);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
"time"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphmodelssecurity "github.com/microsoftgraph/msgraph-beta-sdk-go/models/security"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphmodelssecurity.NewRetentionEvent()
displayName := "String"
requestBody.SetDisplayName(&displayName)
description := "String"
requestBody.SetDescription(&description)
eventQuery := graphmodelssecurity.NewEventQuery()
eventQueries := []graphmodelssecurity.EventQueryable {
eventQuery,
}
requestBody.SetEventQueries(eventQueries)
eventTriggerDateTime , err := time.Parse(time.RFC3339, "String (timestamp)")
requestBody.SetEventTriggerDateTime(&eventTriggerDateTime)
createdBy := graphmodels.NewIdentitySet()
requestBody.SetCreatedBy(createdBy)
eventPropagationResult := graphmodelssecurity.NewEventPropagationResult()
eventPropagationResults := []graphmodelssecurity.EventPropagationResultable {
eventPropagationResult,
}
requestBody.SetEventPropagationResults(eventPropagationResults)
eventStatus := graphmodelssecurity.NewRetentionEventStatus()
requestBody.SetEventStatus(eventStatus)
lastStatusUpdateDateTime , err := time.Parse(time.RFC3339, "String (timestamp)")
requestBody.SetLastStatusUpdateDateTime(&lastStatusUpdateDateTime)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
retentionEvents, err := graphClient.Security().Triggers().RetentionEvents().Post(context.Background(), requestBody, nil)
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
// 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);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\Security\RetentionEvent;
use Microsoft\Graph\Beta\Generated\Models\Security\EventQuery;
use Microsoft\Graph\Beta\Generated\Models\IdentitySet;
use Microsoft\Graph\Beta\Generated\Models\Security\EventPropagationResult;
use Microsoft\Graph\Beta\Generated\Models\Security\RetentionEventStatus;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new RetentionEvent();
$requestBody->setOdataType('#microsoft.graph.security.retentionEvent');
$requestBody->setDisplayName('String');
$requestBody->setDescription('String');
$eventQueriesEventQuery1 = new EventQuery();
$eventQueriesEventQuery1->setOdataType('microsoft.graph.security.eventQuery');
$eventQueriesArray []= $eventQueriesEventQuery1;
$requestBody->setEventQueries($eventQueriesArray);
$requestBody->setEventTriggerDateTime(new \DateTime('String (timestamp)'));
$createdBy = new IdentitySet();
$createdBy->setOdataType('microsoft.graph.identitySet');
$requestBody->setCreatedBy($createdBy);
$eventPropagationResultsEventPropagationResult1 = new EventPropagationResult();
$eventPropagationResultsEventPropagationResult1->setOdataType('microsoft.graph.security.eventPropagationResult');
$eventPropagationResultsArray []= $eventPropagationResultsEventPropagationResult1;
$requestBody->setEventPropagationResults($eventPropagationResultsArray);
$eventStatus = new RetentionEventStatus();
$eventStatus->setOdataType('microsoft.graph.security.retentionEventStatus');
$requestBody->setEventStatus($eventStatus);
$requestBody->setLastStatusUpdateDateTime(new \DateTime('String (timestamp)'));
$result = $graphServiceClient->security()->triggers()->retentionEvents()->post($requestBody)->wait();
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.security.retention_event import RetentionEvent
from msgraph_beta.generated.models.security.event_query import EventQuery
from msgraph_beta.generated.models.identity_set import IdentitySet
from msgraph_beta.generated.models.security.event_propagation_result import EventPropagationResult
from msgraph_beta.generated.models.security.retention_event_status import RetentionEventStatus
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = RetentionEvent(
odata_type = "#microsoft.graph.security.retentionEvent",
display_name = "String",
description = "String",
event_queries = [
EventQuery(
odata_type = "microsoft.graph.security.eventQuery",
),
],
event_trigger_date_time = "String (timestamp)",
created_by = IdentitySet(
odata_type = "microsoft.graph.identitySet",
),
event_propagation_results = [
EventPropagationResult(
odata_type = "microsoft.graph.security.eventPropagationResult",
),
],
event_status = RetentionEventStatus(
odata_type = "microsoft.graph.security.retentionEventStatus",
),
last_status_update_date_time = "String (timestamp)",
)
result = await graph_client.security.triggers.retention_events.post(request_body)
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.