SOLVED

Alerts on Comments in Modern Pages?

Iron Contributor

So now that we are beginning to take advantage of Communications Sites, Modern Pages and News, we are starting to get comments on our pages - which is awesome, but... Nobody knows there are comments on the pages. Is there currently a way to get alerts/notifications (like most other modern Social Collab Tools) that a comment was made on a page? Maybe by email?

49 Replies

I have experienced the same behavior.  Here's a great post that shows how to get them using an API call:

https://www.eliostruyf.com/getting-likes-and-comments-from-modern-pages/

Hi Guys, 

 

I've built a custom solution to receive email notifications on new comments using Microsoft Flow and an SPFx extension. The process is still manual, it requires a click in a button from the browser but all site owners will be notified if new comments are available. The instructions to implement it step by step are available here.

What I do is to embed a Microsoft Forms form on a modern page and for each response (i.e. comment) I get it to send an email to me with the comment and it also creates a new list item in a SharePoint list called Comments on the site. It works really well and gives us a record of every comment, who submitted it and whether we've responded. The form can, of course be added to multiple pages. If you want to show a conversation on a page though you need to display a view of the list which works but my solution works better when users don't need to see other comments.

 

comment_add_item_send_email.jpg

I found that when I downloaded the SharePoint app to my phone I got alerts on my phone when comments were posted in response to News I posted.  I am following the site but I don't know if that is why. I didn't do anything active to set up the alerts.

Having tried a couple of different options I've gone with a Powershell script that uses PnPOnline to retrieve all my modern communication pages and then write any new commentcounts to a separate SharePoint list (or update an existing list item if the post already had comments previously). Then I have an alert setup on the list for any new or modified items. So far works really well. And the script was pretty straightforward to write (luckily, as I am not an expert Powershell guy by any means).

 

I did try Joao Ferreria's excellent solution and it worked well. The only drawback was that whenever we ran the code it modifies every modern page it checks so our last modified datetimes and users were changing regularly and it played havoc with various 'Most Recent' list views we have.

 

Here is my solution how you could make alerts on comments for Classic Publishing Site in SharePoint -> https://rasper87.wordpress.com/2018/11/21/notification-center-inside-sharepoint-on-prem/

Would you be willing to share that script?

Hi Gretchen, happy to share if it's useful. 

 

The solution that I got working for us works as follows:

 

  1. Powershell script, running as a scheduled task, periodically reads the comment count for all News items (List A) on a given site. 
  2. The comment count is compared to the comment count stored on a separate list (List B).
  3. If there is a comment for a News item that previously had no comments then a new item is added to List B with the article URL and the number of comments. If there is an additional comment for News article that already had comments then the list item in List B is updated.
  4.  List B has an alert setup, going to our team Distribution List, whenever List B is added to or modified, which sends an Alert email including the URL of the article.

I don't know if that works for what you are trying to do. I have the script running on my local desktop as I had real problems getting the script task to run on a server with any sort of encryption. That may be a problem for you. Likewise, in my solution there are only ever 4 possible authors of the News items so for now I can send an alert to all 4, if you have lots of potential authors that may be no good, although I don't think it would take much to change the script to send an email to the article author once a new comment is found.

 

Hope that helps. Script attached (hopefully).

Thanks so much!  I'll get it to our more technical team members and see what we can do!

If you could get them to correct the mistakes I made and send it back I'd be grateful! :)