// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models.Security;
var requestBody = new RetentionLabel
{
OdataType = "#microsoft.graph.security.retentionLabel",
RetentionDuration = new RetentionDurationInDays
{
OdataType = "microsoft.graph.security.retentionDurationInDays",
Days = 2555,
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Security.Labels.RetentionLabels["{retentionLabel-id}"].PatchAsync(requestBody);
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphmodelssecurity "github.com/microsoftgraph/msgraph-beta-sdk-go/models/security"
//other-imports
)
requestBody := graphmodelssecurity.NewRetentionLabel()
retentionDuration := graphmodelssecurity.NewRetentionDurationInDays()
days := int32(2555)
retentionDuration.SetDays(&days)
requestBody.SetRetentionDuration(retentionDuration)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
retentionLabels, err := graphClient.Security().Labels().RetentionLabels().ByRetentionLabelId("retentionLabel-id").Patch(context.Background(), requestBody, nil)
// 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.RetentionLabel retentionLabel = new com.microsoft.graph.beta.models.security.RetentionLabel();
retentionLabel.setOdataType("#microsoft.graph.security.retentionLabel");
com.microsoft.graph.beta.models.security.RetentionDurationInDays retentionDuration = new com.microsoft.graph.beta.models.security.RetentionDurationInDays();
retentionDuration.setOdataType("microsoft.graph.security.retentionDurationInDays");
retentionDuration.setDays(2555);
retentionLabel.setRetentionDuration(retentionDuration);
com.microsoft.graph.models.security.RetentionLabel result = graphClient.security().labels().retentionLabels().byRetentionLabelId("{retentionLabel-id}").patch(retentionLabel);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\Security\RetentionLabel;
use Microsoft\Graph\Beta\Generated\Models\Security\RetentionDurationInDays;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new RetentionLabel();
$requestBody->setOdataType('#microsoft.graph.security.retentionLabel');
$retentionDuration = new RetentionDurationInDays();
$retentionDuration->setOdataType('microsoft.graph.security.retentionDurationInDays');
$retentionDuration->setDays(2555);
$requestBody->setRetentionDuration($retentionDuration);
$result = $graphServiceClient->security()->labels()->retentionLabels()->byRetentionLabelId('retentionLabel-id')->patch($requestBody)->wait();
# 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_label import RetentionLabel
from msgraph_beta.generated.models.security.retention_duration_in_days import RetentionDurationInDays
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = RetentionLabel(
odata_type = "#microsoft.graph.security.retentionLabel",
retention_duration = RetentionDurationInDays(
odata_type = "microsoft.graph.security.retentionDurationInDays",
days = 2555,
),
)
result = await graph_client.security.labels.retention_labels.by_retention_label_id('retentionLabel-id').patch(request_body)