For anyone working with event-driven retention in Office 365, you’ll need to know how to set the Compliance Asset Id. The Asset Id is a column automatically added to any list or library in SharePoint that has had an event-driven retention label published to it. Although you won’t see this column in library settings, you will see it on the property detail pane and it can be added to any SharePoint view.
This column is really important for event-based retention! It’s what will be leveraged to be able to apply retention to documents and emails when an event occurs.
Examples of Asset Id:
- All employee documents might have an Asset Id of their unique employee #
- All litigation case files might have an Asset Id of their legal case file #
- All project documents might have an Asset Id of their unique project #
On a related post, Automate Event-based Retention in Office 365, I demonstrate how to apply event-based retention to a Project’s documents when the Project is completed. The document’s Asset Id is an important part of that solution.
For event-based retention to work in that post, the Asset Id on all Project documents covered by the retention had to be tagged with a consistent Asset Id. For example, if everything for Project ‘X’ was tagged with Asset Id ‘12345’, then when Project ‘X’ was complete, anything tagged with Asset Id ‘12345’ with an event-based retention label applied would start its retention.
There are currently 2 options for setting an Asset Id:
Option 1: Manually set it like any other piece of metadata by an end-user. Not ideal.
Option 2: Automated based on some criteria.This could be on ALL documents in the library or you could selectively apply an Asset Id on specific types of Project documents (i.e. Project Charter, Project Change Requests, Project Design, etc.)
This post will demonstrate Option 2 above using a Project Document library as an example.
Special thanks to my MVP colleague, Antonio Maio, for his consultation and verification of some of the content of this post.
Important to know about the Asset id column:
- You cannot default the Asset Id at a site level
- You cannot default the Asset Id at a library level thru the UI, however you can default it using PnPPowerShell (see below)
- You cannot default the Asset Id on a folder and utilize the column default value setting, however you can default a folder (and document set) using PnPPowerShell (see below)
- You can automate the Asset Id at a document level thru code or a Flow (this post!)
- You can manually set the Asset Id at a document level
- Coming soon: you’ll be able to default the Asset Id on a Document Set which will propagate the
- value to all documents within the document set
[Update Mar 3, 2019] Shout out to a Twitter friend, Graham Tyler, for showing me how to update a Compliance Asset Id using PnPPowerShell. You can either default an entire library to the same Asset Id, or set an Asset Id on a specific folder. Here is the cmdlet details:
Set-PnPDefaultColumnValues -List “listname” -Folder “/relative folder name” -FIeld “ComplianceAssetId” -Value “yourAssetId”
Steps to set the Asset Id
First thing to determine is the Asset Id you will use for your documents. In this example, I’ll retrieve the Asset Id from a SharePoint list of Corporate Projects called ProjectRequest. This list is also used for an auto-provisioning process for Project sites and so contains any metadata required for provisioning a Project site. This makes it a great place to also store the project’s unique Asset Id.
Your Asset Id could be an employee #, unique legal case file #, a project #, a RFP #, etc.
Build a Microsoft Flow
This Flow is triggered on an add/update on the Project Documents library on the Project site. It will set that Project’s documents’ Asset Id to the value stored on the above ProjectRequests list. The Flow will:
- Retrieve the unique Asset Id for the project
- If the Asset Id isn’t set for the document, set it
There are a few technical details important to this solution. Shout out to Twitter colleague, Siddle for Business, who helped steer me in the right direction on how to update the Asset Id on a library, something I was having trouble doing up until he helped out. Give him a follow on Twitter! 🙂
Important: since the Flow trigger is on an add/update event and the Flow is also updating a property on the same document (ComplianceAssetId), be careful not to get in an endless Flow loop! To avoid this, ensure you have a condition at the start of the Flow that will evaluate to false after the first update. In my case, I only update the Asset Id if it is not already the correct Asset Id value.
Step 1: Compose the header of the request
Step 2: Compose the body of the request ensuring you’ve identified the correct Asset Id to associate to each document.
Step 3: Send an HTTP request action to update the Asset Id on the document library. The ValidateUpdateListItem method is called to avoid creating a new version of the document on this update.
Once done, the Asset Id will be automatically updated on every document added to the library. This will allow any document tagged with the Asset Id to be processed when an event-based retention label is associated to the library.
Thanks for reading.
Feel free to comment on this post. Would you like to connect with me to ask a more complex/involved question? I’d love to support you in anyway I can. Book a call with me on Pick My Brain! There is a charge for the Pick My Brain call.