Set Retention Label & permanent delete based on retention label

Akshith Reddy Thalla 140 Reputation points
2024-05-02T05:27:21.3166667+00:00

Unable to set the retention label (https://learn.microsoft.com/en-us/graph/api/driveitem-setretentionlabel?view=graph-rest-1.0&tabs=http)

PATCH /drives/{drive-id}/items/{item-id}/retentionLabel

User's image

---I also want to permanently delete based on retention label. Let's say, Delete File with "Obsolete" retention label

Microsoft Security | Microsoft Graph
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Anonymous
    2024-05-06T07:51:52.1533333+00:00

    Hi @Akshith Reddy Thalla

    First of all, the reason for this error is that the retention label named 'Set Retention label' does not exist, you can list all the retention labels for checking, so to solve this problem you need to create a retention label named 'Set Retention label' first, see the link below for how to list and create retention labels.

    List retention Labels:

    https://learn.microsoft.com/en-us/graph/api/security-labelsroot-list-retentionlabel?view=graph-rest-1.0&tabs=http

    Create retention Label:

    https://learn.microsoft.com/en-us/graph/api/security-labelsroot-post-retentionlabel?view=graph-rest-1.0&tabs=http

    For permanent deletion, if you want to use a retention label, you can set the item to be automatically deleted after a specified period of time, or the item can be permanently deleted based on the driveItem's ID.

    About how to set up retention labels:

    https://learn.microsoft.com/en-us/purview/retention-settings#settings-for-retaining-and-deleting-content

    Permanently delete a driveItem by using its ID:

    https://learn.microsoft.com/en-us/graph/api/driveitem-permanentdelete?view=graph-rest-1.0

    Hope this helps.

    If the reply is helpful, please click Accept Answer and kindly upvote it. If you have additional questions about this answer, please click Comment.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.