How to hide posts from Social Corner when they expire

Social Corner can get busy and you may want to hide posts from it after 30 days or so (depending the new post volume).
You can set this up with Power Automate–it takes about 5 minutes with these steps below:

  1. Open Power Automate from your Microsoft 365 toolbar

  2. On the left, click the Create button
    then click select Scheduled cloud flow

  3. Set Flow recurrence and a name, similar to below:

  4. Add a new step

and search for get files

pick Get Files (properties only)

  1. For Site Address, pick the URL of your Intranet or the site where your Social Corner posts reside
    For Library Name, type custom value Site Pages
    For Limit Entries to Folder pick the folder you wish to monitor for expiry /SitePages/SocialPosts or if you have a custom feed for employee welcomes then /SitePages/Welcomes
    For Include Nested Items set No
    And, for Filter Query copy and paste this line
Created le '@{addDays(utcNow(), -30, 'yyyy-MM-ddTHH:mm:ssZ')}'

This last line takes the Created date of the post and calculates 30 days from that date. It will only move items which have passed the 30 days. Feel free to change that number to what you feel is reasonable.

Here is the screenshot of the action:

  1. Add a new step and search for “each”

select Apply to each

  1. For Select an output from previous steps pick “value” like this

Then click Add an action

and search for “move file”, like this:

pick Move file

  1. For Current Site Address pick the same URL you picked in step 5 above
    For File to Move pick Identifier like this
    For Destination Site Address pick the same URL as for Current Site Address
    For Destination Folder pick a folder where you will move expired posts
    like this: image
    (you need to create this folder in SitePages library first)
    And, for If another file is already there choose Move with a new name

Here is the screenshot of the step for clarity:

  1. Save the flow

  2. Test the flow by clicking Test in the top right hand corner

Success run will move files created 30 days ago from SitePages → Welcomes folder to SitePages → Expired. Other files will stay until their time arrives.