Automatically Send Email When News Is Published
By Anatoly Mironov
News in SharePoint are great, it is easy to edit and post news, add pictures and web parts. But you might have thought how you would spread the word better. If your workmates would check the start page on your site or on the SharePoint Home every day, it would be awesome, it might be the case in future. In the meantime though, you probably have considered sending out email notifications to your workmates whenever there is fresh news.
I have good news for you, I can show how you can set up a simple flow in Power Automate, a flow that will trigger whenever a news is posted. You can easily adjust it for your needs, recipients, whether or not you notify if a news has re-published, or perhaps another actions alltogether.
My example flow will create an html formatted e-mail with the title, link to the news, banner image and the description. Let’s just dig into it.
Step 1. Create an automated flow
Go to Power Automate and create a new flow:
Give it a name (I call it “Notify on news”). Choose the trigger “When an item or a file is modified (SharePoint)”.
Choose your site.
For List or Library, click on “Enter custom name” and type “Site Pages”.
Click on “Show advanced options” and then on “Limit Columns by View” and pick “Use all columns (Do not limit)”. We need all the properties to create an e-mail.
Step 2. Take only news
Whether it is news or not is revealed in the property “Promoted State”. It should be 2. (0 is ordinary page, 1 is news before publishing). So this (Promoted State = 2) is our first condition.
Next condition is the Version Number. It should be 1.0 (a major number) and in this case only 1.0, because we don’t email workmates with updated/re-published news (but you might want it, if so change it accordingly).
There is one caveat in the condition. The Promoted State is an integer, the condition is just as it sounds: Promoted State is equal to 2.
The Version Number is a string with the format 1.0 (other valid values are 0.1, 0.2, 1.1, 5.511 etc). If you compare it with 1.0 which is automatically rewritten to 1, you’ll always get a falsy condition resulting in no emails to your workmates.
To get it to work, I convert the Version Number to an integer and then compare it.
Step 3. Email
Well, I would say, it is a no-brainer, especially in this simplifed example (I send it to myself). I’ll keep it that simple to keep the blog post digestable. Let’s compose the e-mail.
I tried almost all the properties, some of them contain information (Description, Banner Image Url, Title) and some of them don’t (Wiki Content, Thumbnails, Topic Header etc).
Here is what I use to create an e-mail.
Try it
Create a news in your site:
Add some text and an image and publish it (“post news”):
A few seconds later you’ll get an email. Marvelous!
As you see, the email has all the important parts: the title, the author, the link, the image and the beginning of the news text - just everything to get your colleague’s attention to discover more and you’ll get what you wanted - spread the good news to people.