Forum Discussion
kalpeshvaghela
Apr 13, 2020Steel Contributor
API to do Like/Unlike of Comments in SharePoint Modern Page
Hi, Is there any API/way available for SharePoint Online using which we can like/unlike particular comment/reply of SharePoint Modern Page? Till now I got only is we can read information about li...
- Apr 13, 2020
Hey kalpeshvaghela ,
You can use the PnPJS library to like/comment a page comment, too. Check out the documentation here.
Basically, after you have the comment ID, you can make these call to like/add a comment to an already existing comment.
sp.web.lists.getByTitle(listID).items.getById(pageId).comments.getById(commentId).like(); sp.web.lists.getByTitle(listID).items.getById(pageId).comments.getById(commentId).replies.add('here is some text');
It worth noting that you can't add a reply to a reply, though. Hope this helps!
Regards.
Carlos_Marins
Apr 13, 2020Iron Contributor
Hey kalpeshvaghela ,
You can use the PnPJS library to like/comment a page comment, too. Check out the documentation here.
Basically, after you have the comment ID, you can make these call to like/add a comment to an already existing comment.
sp.web.lists.getByTitle(listID).items.getById(pageId).comments.getById(commentId).like();
sp.web.lists.getByTitle(listID).items.getById(pageId).comments.getById(commentId).replies.add('here is some text');
It worth noting that you can't add a reply to a reply, though. Hope this helps!
Regards.