Creating a Custom SharePoint News Digest with Power Automate

Microsoft provides a couple of ways to send out an update or digest email. You can use a simple Alert on the site pages library or use the built in News Digest feature to manually send a digest of selected articles. Sometimes you may need to create a custom solution and Power Automate is the right tool for the job.

In this video I demo how to create a custom email digest, using a few Power Automate steps. This is a little more advanced the the template based solutions. I’ve included the code snippets from the video in this blog.

The workflow shown in the video uses the following steps, starting with a ‘Recurrence’ step, which is created when you create a Scheduled Flow from Power Automate studio. This step can be used to configure the frequency at which the Flow runs e.g., daily, weekly, etc.

Code Snippets:

HTML Formatting compose steps. Note that each Compose step uses the previous step as it’s input data. Use the Expression feature to add the code, rather than copying it in directly:

  1. replace(body(‘CreateHTMLTable’),’&lt;a href=&quot;’,'<a href=”‘)
  2. replace(Outputs(‘Compose2′),’&quot;&gt;’,'”>’)
  3. replace(Outputs(‘Compose3′),’&lt;/a&gt;’,'</a>’)

If you’re not a CSS guru, copy the CSS from this blog to style the table: Power Automate HTML Table Styling and Formatting (tachytelic.net)

Use the Send Email v2.0 action to compose the email and click the ‘</>’ button to change to HTML format.

In the body, put the Output CSS first and then the final compose Output. These combined create and format the table.

OData filtering can be used to limit results in the Get Files (Properties Only) step. This example, shows items created in the last 7 days.

Expression code:

  • formatDateTime(addDays(utcNow(),-7),’yyyy-MM-ddThh:mm:ssZ’)

This Microsoft article has more detail on using OData Filtering in Power Automate.

Running the workflow generates and email from the template with a line for each News post.

The final step in the process is to format the email to meet your design requirements using HTML code in the email template and CSS. You can include header images, published dates and other metadata values.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s