How to Send an Email when added a News Post in SharePoint Online site

Copper Contributor

How do you Send an Email to notify a user whenever a new News Post is created in SharePoint Online site?

Please help on how to do this. What are the ways.

news.png

23 Replies

Hi @Matt Weston,

I have done the setup for sending mail when a news post is published. Most of the time the Flow works great but sometimes it doesn't trigger, especially if users change pictures when creting the news post.

It is not even shown as failed in flow. I use "when a file is created(proprties only)" since the client doesnt want notifications for updates. Can it be that the promoted state =2 happen to be changed to something else for some reason when publishing? Have you got some ideas on what can be wrong or troubleshooting steps?

 

Best regards

/Fredrik

@Matt Weston 

 

This works 100% however..... If for some reason i go back to an older news post and edit or republish then another email comes out. Is there a way to send out the email on promote state = 2 (original news post) But not to send out any future emails even if someone makes a change to the post?

@Matt Weston

Hi Matt, this is really good. I have only one issue, I have set the Promoted State to 2, but when I publish the expression result is always false. If I set it to one, then it sends an email (draft or published). I have copied your flow exactly, any ideas?

 

Edit: I have just checked the raw outputs and it is saying the state is 1.

I'm probably too late to help anyone involved in the thread, however, for future users wondering how to solve this issue, here's how I did it.

There is a metadata field known as version number. 

This number increments it's decimal component every time a draft is saved, the first draft will be saved as version 0.1, the next time you open the news page's draft, the auto-saves for that "session" will be saved as a version 0.2. The decimal will only go up once you save a "new" draft.

Once you publish the news article, said version number changes to 1.0, if you were to edit the published article, those changes would be saved as version 1.1 (1.2 if you save it as a draft and keep editing it later on).

If you then decide to republish the news article, its version number will update to 2.0.
As far as i've seen, the pattern keeps going on

Now back to the original question, to avoid resending emails for updated news articles we can simply add a second line to our condition that checks if the version number is exactly 1.0. This way our conditional block checks if the modified file is a published news page (thanks to the promoted state == 2 condition) AND if it's the first version being published (version == 1.0).

NOTE: The "decimal" portion of the version number doesn't act like a decimal; in practice it works more like a second index annexed by a dot.
The sequence of version numbers would go such as:
0.1 < 0.2 < 0.3 < ... < 0.11 < 0.12 < ... < 0.21 < 1.0 < 1.1 ...

I hope this helps any future lurkers.