There is no specific trigger action for whenever SharePoint news is posted. This article explains how you could work around this by using a trigger condition expression.
Original request
Communication website – automatic e-mail when someone has published a new entry?
Power Users Community thread: Communication website.
First Published
In this example we will only trigger a Power Automate flow when a SharePoint Online News Post is posted and when the First Published Date and the Last Modified Date values are within the same minute. After it is triggered we will use the title, published date and the description in an e-mail.
In other words, it is only triggered when you post the news the first time. Or when you republish very quickly ;).
Republishing is out of scope of this example.
PromotedState Enum
In this example we will be looking for News Posts. News Posts are stored in the Site Pages library just like regular pages.
You can identify News Posts by using the PromotedState field value. We will only be using PromotedState value 2, which is a published News Post.
Label | Value | Description |
---|---|---|
NotPromoted | 0 | Regular client side page |
PromoteOnPublish | 1 | Page that will be promoted as news article after publishing |
Promoted | 2 | Page that is promoted as news article |
The flow setup
1. Add the When an item or a file is modified trigger action. Make sure you use the Site Pages library.
2. Add the following expression in settings.
@and(equals(triggerOutputs()?['body/PromotedState'], 2),equals(formatDateTime(triggerOutputs()?['body/FirstPublishedDate'], 'yyyy-MM-ddTHH:mm'), formatDateTime(triggerOutputs()?['body/Modified'], 'yyyy-MM-ddTHH:mm')))
In this example we are using a Send an email action. However, for this scenario you could also use the News Digest feature. Other options could be a Teams message or another kind of notification. Just try it out, be creative
Happy testing!
This blog is part of SharePoint Week. For more great content, click here
About the Author:
My name is Dennis. I am Dutch and I live and work in the UK as an IT consultant. Currently I work a lot with SharePoint online, Microsoft Teams and all the other products of the Office 365 platform. I also like my share of Dynamics 365 and Azure. I try to blog about everything I come across in my daily job. All the content in my blogs are my personal views and experiences.
Reference:
Dennis. (2021). Trigger a flow when news is posted. Available at: https://www.expiscornovus.com/2021/07/30/trigger-a-flow-when-news-is-posted/ [Accessed: 13th September 2021].