5

The requirement is to have a widget(web part/app part) on SharePoint (2016/online) custom page layout that enables users to post comments on pages that are built using the custom page layout.

  1. Comments for each page should be mutually exclusive i.e. comments posted on page A should not be visible on page B
  2. Each comment should have options to
    • Like the comment (and effectively increment the like counter for the comment. Like counter is also displayed on page)
    • Reply to the comment (Replies should be indented appropriately to the parent comment so that they are easily classified as replies. Replies can also have replies (n level deep). Replies can also be liked/shared)
    • Share the comment (via email)
  3. Performance should be good and user experience should be fluid and intuitive.
  4. Solution should also work with SharePoint online (O365) i.e. no wsp deployment/Server side coding.

Looking for solution/guidance in developing the solution using SharePoint app model.

6
+50

This will be a custom solution, below can be high level thoughts which can get you started.

Below 2 Lists are required at least, assuming you already have Article Pages library.

Comment list

CommentId, - Unique id

CommentText - Comment text provided by user

CommentBy - Person and Group who gave comment

ParentCommentId - Lookup CommentId if it is replied to any parent comment

PageId - Lookup from Article Page Library.

PageURL - URL of Page(not sure if it is required)

Like Count - total number of likes on this comment.

Like List

LikeId - unique id

Liked By - Person and Group

CommentId- Lookup from Comment List.

Idea is to write custom CSOM or rest API to read/write comments for particular page. All of below are just CRUD operations on Lists, I have not provided on examples of how to perform create,read, update, delete operation on list via CSOM or REST API, you can refer to MSDN or any other site, there are plenty of examples available.

Now coming to all your questions

  1. Comments for each page should be mutually exclusive i.e. comments posted on page A should not be visible on page B

Query Comment list based on Page id, you will get list of all comments for this particular page Id. When user add comment, Create new entry in comment list with PageId. Keep ParentCommentId to empty, from this you can identify that current comment is parent comments. when any user like a comment, create new entry in Like list with CommentId, also update comments list entry by incrementing counter. If you want them to undo like, do the reverse.

2a Like the comment (and effectively increment the like counter for the comment. Like counter is also displayed on page)

Query Like list and display current likes for a particular comment. Add entry in Like list when a comment is liked.

2b. Reply to the comment (Replies should be indented appropriately to the parent comment so that they are easily classified as replies. Replies can also have replies (n level deep). Replies can also be liked/shared)

When a reply to comment is given, create new entry in Comment List, but in this case also update ParentCommentId. this will identify that this is child comment of some parent comment.

Use your html skills to make indentation based on wheather a comment is parent comment or reply to some comment. your code logic should handle replied within replies etc based on ParentCommentId column.

2b. Share the comment (via email) Not sure what is required here...but if it is to share comment to someone in email. on click of share, read the comment text and open new mail window(via javascript) and pass comment text as body of email. You will get

mailto:username@example.com?subject=Subject&body=message%20goes%20here

Question 3 - this will be purely based on how effective your code retrieves list data...this is very open ended question.

Question 4 - Above solution is client side and you can create either APP or do it via pure javascript injection on page layout.

Hope this helps..!!

Edit

To make sure list threshold values are handled properly, create Indexes on below columns and make sure you are always using filter in order of column mentioned below.... Ideally SharePoint list can hold millions of records and if our information architecture is designed properly and indexes and CAML query are based on this filters, we should be good.

Comment List

PageId, CommentId, ParentCommentId

Like List

CommentId, LikeId

  • Thanks Siddharth for your reply. I had considered this approach but was worried about the case when list view threshold limit of either or both the SharePoint list is reached. This could happen for popular articles where people start discussion as posting multiple comments and replies or liking the article. What do you think? – Vineet Desai Dec 19 '16 at 7:32
  • it's a shame we'd have to resort to this after they deprecated the social comments and noteboard functionality, as that's what it did natively – Eric Alexander Dec 19 '16 at 14:01
  • 1
    @Vineet Desai... It think threshold value shall not pass because in practical scenario for a single page there won't be more than 5000 comments..for any page, to get data first filter would be PageId and we should be indexing columns on which filters is required...I will update answer accordingly.. – Siddharth Vaghasia Dec 19 '16 at 14:07
  • @EricAlexander.. very true. Atleast they should have given some alternative before depricating. – Vineet Desai Dec 19 '16 at 14:21
  • 1
    @VineetDesai.....storing data in DB can be option, in fact many a times application are design to store some data in DB....I think 5000 comments for a single page will not happen in real time...still if this is case, we can create another 2 archive list and move older comments there....we can have button like show old comments etc and get data from archive list if user is asking to see...like how facebook show comments....I still think, for this particular requirement keeping data in SharePoint would work...it is just we have to design information architecture carefully... – Siddharth Vaghasia Dec 20 '16 at 7:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.