In the previous blogs, (Part 1) I showed you how to set up a SharePoint site to store the scheduled news, and (Part 2) how to enable a SharePoint site to author scheduled news. 

In this final blog of the series, we'll use Power Automate aka Microsoft Flow to make the news scheduling happen.

Part 3 - Creating flows for news scheduling 

We need the following two flows to make this feature work:

  • News Scheduler
  • News Publisher

Let's start by creating our first flow i.e. News Scheduler.

Flow 1 - News Scheduler

This flow will be associated to the Site Pages library of the site we enabled in Part 2 (where authors will be creating news content) i.e. The Landing site.

Steps

  • Select Automated flow from the list of given options

  • A dialogue box will appear, Enter the name of the flow and select when a file is created or modified (properties only) as a trigger then click Create.

  • On the next screen select your site (if your site is not visible then enter the site address manually) and Library Name (if Site Pages is not available as an option then enter it manually)

  • Create a variable named Site Address to store the site address and object containing true/false value using the site page Publishing Date value

Use the formula below for Compose action 

empty(triggerBody()?['Publishing_x0020_Date'])

  • Now use the if condition to filter the scheduled news from the other news using the Promoted State property of the site page and the outputs from the Compose action.

  • The condition in the above figure will only be true if Promoted State value is equal to 0 and Publishing Date is not empty.
  • And if the condition is true then add the page details to the News list in the News Scheduling site, so that it can be published as a news article on the specified date.

  • You can simply terminate the flow in case of false condition.
  • Click on the Save button at the bottom and your first flow is completed.
  • To Test the flow, go to the Landing site and create a Site Page named My First Scheduling News.
  • In the properties look for the Publishing Date property, enter a date and Publish the page.
  • Previous step will trigger the News Scheduler flow, check your flow run history to make sure there was no error and flow ran successfully. (Flow trigger time varies as it depends on your license).
  • As this is a very simple flow there might be no errors, In a successful case News Scheduling flow will create an item in the News list (News Scheduling site).
  • Go to the News list and you will see the details of the Test page.

Flow 2 - News Publisher

This flow will be associated to the News list in the News Scheduling site. It will run daily at a specific time and check if the publishing date of any news item matches today’s date, if yes then it will publish that news.

Steps

 
  • Select Scheduled flow from the list of given options
  • A dialogue box will appear, enter the name of the flow and scheduling details then click Create.

  • On new screen under Recurrence add a new step to compose date object. Enter the formula below to get the today’s date

formatDateTime(utcNow(),'yyyy-MM-dd')

  • In the next step fetch the items from the News list where Publishing Date is equals to today’s date, use the Output from the Compose Date step for today’s date

  • In the next step, add the loop and perform the http requests, starting with Checkout Page
  •  Promote site page to a news post.
This is the step about which we said in Part 1, that will convert your site page to a news post (In technical terms you are promoting a site page to a news post).
 
 
  •  Publish (page will be checked in automatically).
 
  •  Update News list item to published.
 Image below illustrates all the News Publisher flow steps in collapsed state

  • Click on the Save button at the bottom , to save your flow.

Test News Scheduling

If you are reading this, it means you have successfully implemented all the following steps of this blog series:

Now it’s time to put news scheduling to the test.

Steps

  • Go to The Landing site and create a site page.
  • Enter your news content in this site page and in the properties select Publishing Date.
  • Save and Publish the page, it will trigger the News Scheduler flow.
  • News Scheduler flow will check if Publishing Date property of the site page is blank or it contains some date value.
  • If Publishing Date value is blank the flow will terminate.
  • But if Publishing Date property contains some date value flow will create a record in News list (which was created in the News Scheduling site) with publishing date.
  • Now News Publisher flow will run at the specified time and read the News list.
  • If News list contains a record with publishing date of today, then News Publisher flow will promote this site page to news.
  • Now go to the site page and you will see the site page has become a news article, which is visible in news webparts across the site.

Conclusion

During our 3 series blog journey we have tried to resolve the problem of news scheduling based on the generic understanding, but feel free to amend it to your needs. It was a long road and I hope the provided information was useful to you.

This is not the end as new modern mobile intranet (SharePoint), comes with many possibilities and integration with Microsoft Power Platform brings all those possibilities to life. 

Regards,

MBDA