다음을 통해 공유


MS Flow – SharePoint Online: Page (Article) archival process

Introduction

One of the key requirements for any enterprise SharePoint implementation is to transition Page to an “archive” state when they are no longer in use. 
There are multiple way to achieve that, we are using following approach :

  • Keep a separate ‘Archival’ document library for archived pages. 
  • ‘Archival’ library will have all restrictive setting like ‘Not appear in search’ , ‘Restrictive permission’ etc.
  • Move specific ‘Content Type’ pages from ‘Pages’ library to ‘Archival’ library after reaching retention time frame.
  • Update ‘Pages’ library field (Processed) when archival process is complete to ‘Done’. (Delete if needed)
  • Periodically run above process.

Using MS Flow automate processes and tasks we can achieve these activities quite easily. This flow needs to be setup with admin privilege which can run periodically and perform archival process.  

Microsoft Flow Steps

Below are the steps for creating the Flow :

  • Create ‘Scheduled Flow’ which will run as at needed time period. (Recurrence)
  • Create 2 variables for ‘Content Type Id’ and ‘File Relative Page’
    • Content Type ID: This will be used to filter results while retrieving the Pages
    • File Relative Path: To store relative path of file for copy functionality 

           

  • Use ‘Get Files’ step to get Pages based on filter 

    Filter: (ContentTypeId equal to ‘Content type Id’) and (Processed not equal to ‘Done’ ) and (Created Date greater then ‘retention policy time period’ )    

  • Loop through each item retrieved from above step.
  • Parse JSON of each item.
    • To get the JSON Schema for 'Parse JSON' step : Test the Flow and retrieve from "Get Files" step.
  • Retrieve Page relative path and set the ‘File Relative Path’ variable.

  • Use “Copy File” Step to Copy file from relative path -> archive library.
  • Check-out Exiting file 
  • Update “Processes” field to ‘Done’.
  • Check-In file.

                              

Many times its needed to 'Move' or 'Delete' the file from original library instead of 'Copy', for that we can use "Move File" or "Delete File" actions.