Hello,
If someone likes a disciussion post, is there a way to receive an email notification?
Thanks,
Technology Tips and News
Hello,
If someone likes a disciussion post, is there a way to receive an email notification?
Thanks,
Hi,
There seems no direct method to monitor the Like behavior performed by users.
As a workaround, you can create a custom timer job to check the a feed of activity by the current user periodically, then send an email with the specific information from the feed accordingly.
About how to work with custom timer job:
http://www.codeproject.com/Tips/634208/Create-and-Deploy-Custom-Timer-Job-Definition-in-S
How to get the users who the like the specified post using SPSocialFeedManager.GetAllLikers method:
Thanks
Patrick Liang
Hello,
Try this...
1) Insert JQuery code on the like button click. to create an entry in a custom list "Likes". (use CSOM)
2) Event receiver on the "Likes" list (your custom list) -> send email on the ItemAdded - Event.
Hi,
The return value of the SPSocialFeedManager.GetAllLikers method is The users who the like the specified post as a collection of SPSocialActor objects.
A SPSocialActor object Represents a user, document, site, or tag in social feed and following activities, you can get the user who like this post with it:
Thanks
Patrick Liang
$('.classOfLikeButton').click(fucntion(){ var ctx = new SP.ClientContext().get_current(); var web = ctx.get_web(); var user = web.get_currentUser(); var list = web.get_lists().getByTitle("LikeList"); ctx.load(user); ctx.load(list); ctx.executeQueryAsync(Function.createDelegate(this, this.OnSuccess), Function.createDelegate(this, this.OnFail)); }); function OnSuccess(sender, args) { var listCreationInformation = new SP.ListItemCreationInformation(); //Object for creating Item in the List var listItem = list.addItem(listCreationInformation); listItem.set_item("Title", user.get_title()); listItem.update(); //Update the List Item ctx.load(listItem); ctx.executeQueryAsync(Function.createDelegate(this, this.userAdded), Function.createDelegate(this, this.OnFail)); } function OnFail(sender, args) { alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace()); } funstion userAdded(sender, args) { alert("user added"); }
Please note, above code is just adding the user who liked the post to a list "LikedList". This list will have event receiver code to send email SPUtility.SendEmail(...);
Please put extra condition to check if post is liked or unliked as you click the same button for both cases. I am sure there will be a w