Sharepoint Retention : Customize Document Retention Period as per metadata field value

Copper Contributor

Hi Team,

 

I am very new to Retention Label and Retention Policy.

I am able to create Retention Policy in Microsoft Purview and retention label is also applied on documents in Sharepoint Library. 

 

Now , as per the requirement we need to apply retention on documents on the basis metadata field (Retention Start Date) value in Sharepoint Library.

 

Suppose if Retention Start Date value is 05-03-2021 then the document should be deleted in 2026 .

If Retention Start Date is 08-07-2019 then the document should be deleted in 2024.

 

Kindly let me know how we can achieve this.

 

Regards

Kartik

 

2 Replies

@vkartik 

To customize the document retention period based on a metadata field value in SharePoint, you can use a combination of retention labels, retention policies, and workflow.

1. Create a Retention Label: First, create a retention label that applies to the documents in your library. This retention label should have a default retention period (e.g. 7 years) that will be used for documents without a retention start date.

2. Create a Retention Policy: Create a retention policy that includes the retention label created in step 1. This retention policy will be applied to the library.

3. Create a Workflow: Create a workflow that triggers on document creation or modification and checks the value of the retention start date field. Based on the value of this field, the workflow should update the retention label for the document to set a custom retention period.

4. Configure the Workflow: In the workflow, use conditional statements to set the retention period based on the value of the retention start date field. For example, if the retention start date is 05-03-2021, set the retention period to 5 years from that date (i.e. the document should be deleted in 2026). If the retention start date is 08-07-2019, set the retention period to 5 years from that date (i.e. the document should be deleted in 2024).

5. Publish the Workflow: Publish the workflow and associate it with the library. This workflow will run automatically whenever a document is created or modified in the library.

With this approach, the retention label will be automatically updated based on the value of the retention start date field, and the documents will be deleted according to the custom retention period set by the workflow.

 

If I have answered your question, please mark your post as Solved
If you like my response, please give it a like

@Deleted - can you please explain how to implement step #4? When the workflow kicks-off on item creation or updates, the workflow can assign a retention label (after comparing the retention start date metadata field). How can we set the retention period from the workflow? 

My understanding is that the workflow should assign a retention label to a document when retention start date (metadata field) is equal to current date. This might require a scheduled flow to iterate through all documents in a library. Am I missing a more simpler approach? 

Thanks!
Bhargav