Undeclare a record (in place)

In SharePoint Online you can declare and undeclare records in place. In this article I am showing you how you can undeclare such a record via the Graph API and Power Automate.

Inspiration

This question from Dhileep_Varma:

I am trying to create a workflow which goes through all the documents in the site collection & check if it is already declared as record. If so i want to undeclare it as record without using Plumsail actions.

Power Users Community thread: undeclare in place record from Power Automate.

In Place Records

It is probably useful to know that there are different ways of declaring and undeclaring records. If you want to know a bit more details about this subject I can highly recommend the Modern vs Classic In Place Records Management in SharePoint article from Joanne Klein as a starting point. She has a lot of great articles about this topic as well, so definitely check out this site.

In this article I am focused on the Modern (In Place) undeclare scenario. Below is a small animation how declaring a record would work via the SharePoint interface. Undeclaring would be similar by just setting the label to none. In this article I want to achieve that via Power Automate 🙂

Enumerate items in a list

Lets start by finding all the declared records in a document library.

Normally I would use the Send an HTTP request to list items and its metadata. But in this instance I thought it would be fun to use the Enumerate items in a list method from the Graph API.

In this setup I am using an $expand parameter to also retrieve the _ComplianceTag & IsRecord fields. This gives me the option to check if an item is declared as a in place record.

Note: I tried to also use a $filter parameter in the same URI. I did not manage to get that working with the _ComplianceTag field. Maybe I will have another attempt later to get this working as well.

Flow setup

Before you start: make sure the account you are using for the SharePoint connection is Site Collection Administrator. Thanks Joanne for giving me the heads-up that I forgot this in my blog 😀

undeclarerecordsinbulk

1. Add a Manually trigger a flow trigger action.

2. Add a two Initialize variable actions. Make sure both are of type string and they are storing the GUIDs of both the site and the list.

undeclarerecordsinbulk05

3. Add a Send an HTTP request action (from the Office 365 Groups connector). Use the URI from the code snippet below.
This action is still in preview but not Premium, unlike the HTTP request action.

undeclarerecordsinbulk02

4. Add a Filter Array action. Use the value field of the body in the From. In the criteria check if the _ComplianceTag field value is equal to your specific label.
In my setup that label is RecordManagementLabel.

undeclarerecordsinbulk03

5. Add an Apply to Each action. Use the Body field of the Filter Array action.
This action will loop through every item which has the label.

6. Add a Send an HTTP request to SharePoint action within the Apply to Each loop. Select your site in the Site Address. Use a POST method. Use the URI & Body from the screenshot or code snippet below.
This step sets the value of the _ComplianceTag to an empty/none value via the SetComplianceTag method. This will undeclare the record.

undeclarerecordsinbulk04

That should be it for the setup.

Happy testing!

You may also like...

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.