Namespace: microsoft.graph.security
Update the properties of a retentionLabel object.
To update a disposition review stage, include the actionAfterRetentionPeriod property in the request body with one of the possible values specified.
This API is available in the following national cloud deployments.
Global service |
US Government L4 |
US Government L5 (DOD) |
China operated by 21Vianet |
✅ |
✅ |
✅ |
❌ |
Permissions
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.
Permission type |
Least privileged permissions |
Higher privileged permissions |
Delegated (work or school account) |
RecordsManagement.ReadWrite.All |
Not available. |
Delegated (personal Microsoft account) |
Not supported. |
Not supported. |
Application |
Not supported. |
Not supported. |
HTTP request
PATCH /security/labels/retentionLabels/{retentionLabelId}
Request body
In the request body, supply only the values for properties to update. Existing properties that aren't included in the request body maintain their previous values or are recalculated based on changes to other property values.
The following table specifies the properties that can be updated.
Property |
Type |
Description |
descriptionForAdmins |
String |
This is an optional property that provides the label information for the admin. |
descriptionForUsers |
String |
This is an optional property that provides the label information for the user. |
dispositionReviewStages |
microsoft.graph.security.dispositionReviewStage collection |
Review stages during which reviewers are notified to determine whether a document must be deleted or retained. |
retentionDuration |
microsoft.graph.security.retentionDuration |
Specifies the number of days to retain the content. |
defaultRecordBehavior |
microsoft.graph.security.defaultRecordBehavior |
Specifies the locked or unlocked state of a record label when it is created. The possible values are: startLocked , startUnlocked , unknownFutureValue . |
labelToBeApplied |
String |
Specifies the replacement label to be applied automatically after the retention period of the current label ends. |
Response
If successful, this method returns a 204 No Content
response code.
Examples
Request
Here's an example of a request.
PATCH https://graph.microsoft.com/beta/security/labels/retentionLabels/9563a605-e827-4324-a5a9-09efddff1e50
Content-Type: application/json
Content-length: 555
{
"@odata.type": "#microsoft.graph.security.retentionLabel",
"retentionDuration": {
"@odata.type": "microsoft.graph.security.retentionDurationInDays",
"days": 2555
},
}
// 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);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
mgc-beta security labels retention-labels patch --retention-label-id {retentionLabel-id} --body '{\
"@odata.type": "#microsoft.graph.security.retentionLabel",\
"retentionDuration": {\
"@odata.type": "microsoft.graph.security.retentionDurationInDays",\
"days": 2555\
},\
}\
'
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
// 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)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
// 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);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
const options = {
authProvider,
};
const client = Client.init(options);
const retentionLabel = {
'@odata.type': '#microsoft.graph.security.retentionLabel',
retentionDuration: {
'@odata.type': 'microsoft.graph.security.retentionDurationInDays',
days: 2555
},
};
await client.api('/security/labels/retentionLabels/9563a605-e827-4324-a5a9-09efddff1e50')
.version('beta')
.update(retentionLabel);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
<?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();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
Import-Module Microsoft.Graph.Beta.Security
$params = @{
"@odata.type" = "#microsoft.graph.security.retentionLabel"
retentionDuration = @{
"@odata.type" = "microsoft.graph.security.retentionDurationInDays"
days =
}
}
Update-MgBetaSecurityLabelRetentionLabel -RetentionLabelId $retentionLabelId -BodyParameter $params
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
# 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)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
Response
Here's an example of the response.
HTTP/1.1 204 No Content