Forum Discussion
How to Send an Email when added a News Post in SharePoint Online site
Hi Mbryant705, sorry I realised I completely forgot to follow up on this post, so also apologies to everyone else involved in the thread.
In a very simple Flow, I can send an email notification when a news item is published. There are a couple of things to be aware of:
- Site Pages won't normally appear in the list of libraries in the trigger, therefore you need to select "Enter a custom value" and then type in Site Pages
- The published state of a document is held within a metadata field called "Promoted state". 1 = in Draft, 2 = Published. If it's a standard site page, not a news item, the Promoted state will be 0.
I can create a condition so that if the Promoted state = 2 (News Item is published) then I can send an email to the required user(s). I can alternatively use the Flow actions to send out a push notification, send a message to Teams etc however you want to get your notification out.
An example Flow is attached to this post. I hope that helps.
Hi Matt Weston thank you for the info, this worked for me to send notifications, but I wanted to ask if you knew a way to add the functionality of adding the content of the news post to the email you send, similar to the way it sends when you use the "send by email" option at the top of the News post page after you publish it?
I can use the "description" dynamic content from the original trigger to put the text into the email, but if there are any images or other things added, that doesn't cover it.
Thanks in advance!
- Matt WestonApr 18, 2019Iron Contributor
Hi KevinO1984 that's a great question and a good extension of what we've already done.
As my trigger is "When a file is created or modified (properties only)" I'm able to see the properties of the page coming back. If I've used another trigger, I'll need to use the action "Get File Properties" to get the same info.
There are two properties which I could use to add some more info to my email:
- Banner Image URL
- Description
Banner Image URL will take the image url of the image which I have assigned as the header of my news page. If I have no header, this field will be populated with the first image that it finds on the page. This is how the rollup image to the news web part works. You can take this URL and use it within HTML in our email.
The Description takes the first paragraph from the news item, so again you can use this to add into your email. I don't think there's a native way of grabbing the entire news article from the properties as it doesn't get tagged as metadata, but I'll have a look to see if there are other options which we can explore.
- fvp11Nov 27, 2019Copper ContributorHi Matt. Is there anyway you could share this Flow?
As I understand it, you have designed a Flow that can send an email, when a news post have been published 🙂 Would really like to use that.- Matt WestonNov 27, 2019Iron Contributor
Hi fvp11, I've blogged and vlogged it 🙂
https://youtu.be/24MgEZn6Y7c
https://collab365.community/using-flow-sharepoint-news-notifications/
If you need any help, please don't hesitate to let me know.
- KevinO1984Apr 18, 2019Copper Contributor
That helps a lot, thank you for taking the time to explain it to me. I was able to get the link to the image to show up, now i just need to figure out how to code it so it show up in HTML or something.
Have a great day!