0

I need to create a SharePoint online retention policy on the document library to keep documents forever. To do this, I am using the Office365 compliance center. The condition is based on a choice column. For instance, if the users select Policy, then that records need to keep forever. Is this something that we can achieve using the Office365 compliance center?

Kind Regards

1
  • Just a note from my experience relying on end users to tag stuff does not work out so well. I'd look at retention from a library or site level. Aug 27, 2021 at 22:26

1 Answer 1

0
  1. Firstly, you have to create a retention policy in O365 complaince center. Select "Retain items forever" in Define retention settings. enter image description here

  2. Publish the retention label on your tenant.

  3. Go to the document library, click Automate > Power Automate > See your flows, create a Automated cloud flow and set trigger as When a file is created or modified.

  4. Built a flow like below. I invoked the Send an HTTP Request action from a Power Automate Flow to make a REST call against the document using the SetComplianceTag method. enter image description here

Yes/No is a Yes/No type column in my document library. You can modify the condition in the flow based on your own choice column. enter image description here

Details of the Send an HTTP Request action:

  • Method: POST

  • Uri: /_api/web/lists/GetByTitle('<libraryname>')/items(@{triggerOutputs()?['body/ID']})/SetComplianceTag()

  • Headers:

     Accept application/json;odata=nometadata
     Content-Type application/json;odata=nometadata
    
  • Body:

     {
         "complianceTag":"<RetentionPolicyName>",
         "isTagPolicyHold":false,
         "isTagPolicyRecord":false,
         "isEventBasedTag":false,
         "isTagSuperLock":false,
         "isUnlockedAsDefault":false
     }
    
  1. Now the retention policy can be automatically applied when a file is created or modified in the library and the Yes/no field of the file is set to Yes.
1
  • Thanks Allen, we using E5 license and I was wondering with this license, is there any limitation with how many records we can have?
    – Harris
    Sep 1, 2021 at 3:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.