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.
In the request body, supply only the values for properties that should be updated. Existing properties that aren't included in the request body maintains their previous values or be 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.
// 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 RetentionDuration
{
OdataType = "microsoft.graph.security.retentionDuration",
},
DescriptionForAdmins = "String",
DescriptionForUsers = "String",
LabelToBeApplied = "String",
DefaultRecordBehavior = DefaultRecordBehavior.StartLocked,
};
// 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);
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.
// THE CLI IS IN PREVIEW. NON-PRODUCTION USE ONLY
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.retentionDuration"\
},\
"descriptionForAdmins": "String",\
"descriptionForUsers": "String",\
"labelToBeApplied": "String",\
"defaultRecordBehavior": "String"\
}\
'
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 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.RetentionDuration retentionDuration = new com.microsoft.graph.beta.models.security.RetentionDuration();
retentionDuration.setOdataType("microsoft.graph.security.retentionDuration");
retentionLabel.setRetentionDuration(retentionDuration);
retentionLabel.setDescriptionForAdmins("String");
retentionLabel.setDescriptionForUsers("String");
retentionLabel.setLabelToBeApplied("String");
retentionLabel.setDefaultRecordBehavior(com.microsoft.graph.beta.models.security.DefaultRecordBehavior.StartLocked);
com.microsoft.graph.models.security.RetentionLabel result = graphClient.security().labels().retentionLabels().byRetentionLabelId("{retentionLabel-id}").patch(retentionLabel);
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
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new RetentionLabel();
$requestBody->setOdataType('#microsoft.graph.security.retentionLabel');
$retentionDuration = new RetentionDuration();
$retentionDuration->setOdataType('microsoft.graph.security.retentionDuration');
$requestBody->setRetentionDuration($retentionDuration);
$requestBody->setDescriptionForAdmins('String');
$requestBody->setDescriptionForUsers('String');
$requestBody->setLabelToBeApplied('String');
$requestBody->setDefaultRecordBehavior(new DefaultRecordBehavior('string'));
$result = $graphServiceClient->security()->labels()->retentionLabels()->byRetentionLabelId('retentionLabel-id')->patch($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.
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.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see: https://aka.ms/ContentUserFeedback.