Category
I have used js-advanced-commenting for my SP online, all the functions are fine, but it doesn't have any notifications when Replying to comments or Ping users.
Any idea how can i do this?
Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.
@sudharsank I believe you wrote this cool sample, would you have any advice on how to get started on implementing what @tranthachthao1995 would like?
@tranthachthao1995 I am working on the email functionality for reply, once it is tested will release the new version of the component and also will post the code.
Thanks @hugoabernier and @sudharsank for feedback
@tranthachthao1995 Please follow the below steps to send an email if an reply is posted.
Following are the modifications that has to be done on 'SPHelper.ts'
import "@pnp/sp/sputilities";let updateComments = await this.updateComment(pageurl, comments);if (commentJson.parent !== null) {
let allComments = await this.getComment(pageurl);
allComments = JSON.parse(allComments);
let parentComment = _.find(allComments, (o) => { return o.id === commentJson.parent; });
let parentCommentUser = await sp.web.getUserById(parentComment.userid).get();
let toEmail = [`${parentCommentUser.Email}`];
let mailsubject = "Reply to your comment!";
let emailBody = `A reply has been posted by '${commentJson.fullname}'`;
this.sendEmail(toEmail, mailsubject, emailBody);
}
public sendEmail = async (to, subject, body) => {
return await sp.utility.sendEmail({
To: to,
Subject: subject,
Body: body
});
}
Thats it. Try the above steps and let me know if you have any clarifications or facing any issues.
Happy coding...
Hi @tranthachthao1995, have you tried the solution mentioned above? Please let us know.
Sorry I missed your guide.
I just apply it and the result is that it works well. Thanks @sudharsank so much.
@tranthachthao1995 I hope it resolves your question. Can you please close this issue?