All Content
Timespan
explore our new search
Implementing Purview Event-Based Retention via Code
Image Source: Shutterstock.com
Microsoft Purview
Sep 28, 2023 7:22 AM

Implementing Purview Event-Based Retention via Code

by HubSite 365 about Martin Lingstuyl [MVP] (Home on Blimped)

Microsoft MVP | Microsoft 365 Architect @I4-YOU | Co-maintainer at CLI for Microsoft 365 (PnP) | Blogger ✍️ | Family man 👨‍👩‍👧‍👦 | Cyclist 🚴‍♂️

AdministratorMicrosoft PurviewSecurity

Unlock Microsoft 365 Purviews potential: Apply and manage data retention labels across SharePoint, OneDrive, Teams and Exchange.

Understanding Microsoft Purview Event-Based Retention Via Code

In a recent blog post authored by Martin Lingstuyl, the focus was laid on how to leverage Purview's event-based retention mechanism using code. The blog extensively discussed Microsoft 365 Purview and its ability to generate and publish retention labels that can be subsequently applied to data across numerous Microsoft platforms like SharePoint, OneDrive, Teams and Exchange.

The information contained in the blog essentially helps users understand how they can define the content to retain, how to lock it like a record, and how to effectively delete the content after a specific retention period has ended. A significant chunk of the blog was dedicated to offering insights on the programmatic management of Purview retention labels and their applications to SharePoint contents.

The blog post consists of a 5-part series that elucidates various aspects of managing and applying Purview retention labels using code. It dives right into the aspect of using Microsoft Purview event-based retention using code and guides the readers on how to discover and rectify incorrectly applied Purview retention labels.

A Closer Look At Event-Based Retention With Microsoft Purview

The blog post then discusses the concept of event-based retention, its meticulous setup, and important considerations to ponder upon, such as knowing that you can't delete event-based labels after their creation. It included some reasons why scripting can prove handy for creating event-based labels, which includes the ability to follow a controlled, reviewable, and repeatable process while reducing error margins.

Subsequently, the post guides on how to create an event-based retention label using Security & Compliance PowerShell, Microsoft Graph API, and CLI for Microsoft 365. There's room for manual unlocking and updating an item before applying the retention label. Automating few or all of the steps is also possible.

The blog also talks about the Asset Id, which is an extra piece of metadata that must be added to the files. It is used to identify one or multiple files and is added to the event triggered in the third step. Microsoft 365 tenants can then use the Asset Id to find all relevant files to enforce the retention period.

The post concludes with a note on how to apply the event-based label using different methods like the SharePoint REST API, CLI for Microsoft 365, Pnp.PowerShell, and CSOM. Upgrading the list item, updating the Asset Id, and applying the label are executed independently, leading to a single record version, which is preferred.

Read the full article Working with Purview event-based retention using code

Microsoft Purview - Guide to Implementing Purview Event-Based Retention via Code

Learn about Working with Purview event-based retention using code

Want to learn more about working with Microsoft Purview? Here is a deep dive into how to programmatically manage Purview event-based retention labels using code. This comprehensive guide provides a wealth of knowledge for anyone interested in data retention and management in SharePoint, OneDrive, Teams, and Exchange. With this article, one will gain a clear understanding of how retention labels work in these applications and be ready to implement them in their own projects.

Our tutorial is broken down into five parts: Managing and applying Purview retention labels, working with Purview event-based retention, finding and fixing incorrectly applied labels, applying Purview retention labels to folders, and automating Purview data retention through Azure Functions.

Throughout our guide, we cover a range of concepts and offer step-by-step instructions, ensuring that the reader can easily follow and understand. We also highlight crucial points to consider when working with data retention labels, such as the Compliance Asset Id and the implications of choosing certain settings.

Part of our discussion is also dedicated to scripting, with a focus on its benefits such as increased control and repeatability of the process, and ensuring accuracy across deployments. This is particularly pertinent to event-based retention where labels cannot be deleted once created, so precision is key.

We provide comprehensive scripts for creating and publishing event-based labels, applying them to data, and even triggering an event to start the retention period. This guide spans multiple platforms and APIs, including the Microsoft Graph API, SharePoint REST API, and the CLI for Microsoft 365.

In addition, we include some important note sections. These are intended to draw attention to some of the unique features and potential pitfalls when working with data retention. We include warnings about the difficulties of updating the Asset Id field after applying a label and advise readers to update it before label application to avoid any issues.

Beyond creating and managing labels, we also tackle how to monitor the distribution status for successful label application and identify which data has been labeled through the Purview dashboard. Useful for IT compliance administrators who need to keep a constant eye on data retention status.

In conclusion, we provide some thoughtful insights about event-based retention. We highlight its pros, cons, and unique use-cases. Finally, we link to useful resources for further learning and encourage interaction with our readers, promoting a healthy exchange of ideas and experiences. Adapt this guide to your needs, and happy labeling!

Additional Resources:

Credit: Martin Lingstuyl, duly recognized for his expertise and contributions to the blog post.

More links on about Working with Purview event-based retention using code

Working with Purview event-based retention using code
Feb 21, 2023 — This can be done by creating a new event in the Purview dashboard. The event will contain the Asset Id that you've assigned to the file(s) and ...
Start retention when an event occurs
Jul 28, 2023 — Retention labels based on events often trigger a disposition review at the end of the retention period, so that a records manager can manually ...
Managing and applying Purview retention labels using code
Feb 15, 2023 — An overview of the different ways you can manage and apply Microsoft 365 Purview retention labels in SharePoint using code.

Keywords

Purview event-based retention, Working with Purview, Purview using code, Code for event-based retention, Retention code Purview, Purview event retention, Coding for Purview, Event-based code Purview, Purview retention strategies, Implementing Purview retention.