In SharePoint 2007 the only lists that offer a comments feature are the posts list in the Blog site template. Wouldn’t it be nice to allow people to post comments on other types of lists like announcements or documents? Well after lots of trial and error I figured out how to do it.
What you will need
- Two Lists
- SharePoint Designer
- Basic knowledge of HTML
I’ll assume you already have a list setup on which you want to allow users to comment. For this example I will use a standard Announcements list.
So the first thing we need to do is create a list to hold our comments. I just used the following columns:
- Title
- Body
- Post (lookup to main list’s ‘Title’ column)
In the main list you will need to add a column that points back to the comments list.
- Go to the list settings page and click ‘Create Column’
- Name the column ‘Comments‘ (the name does not really matter. Set the type to ‘Lookup‘
- The lookup should get information from the comments list you created. The column should be set to the lookup column in the comments list. See the screenshot below.
This column will show us the number of comments each item in our list has.
Ok so now that we have the two lists pointing to each other we need to show the comments on a page with our list item.
- Add a couple of items to each list just for testing purposes.
- Create a blank web part page.
- Add a data view web part to the page to display the Annoucements list.
- Create a parameter on the dataview named item and set it to get the variable from the query string.
Note : Whatever link user click to get to this page will need to pass the item ID as a variable in the query string in order for this solution to work. In my example I am passing the ID in the ‘item’ variable but you can use whatever you want.set up parameter - Add a web part to the page below the data view to display your comments list. Create a web part connection to filter the comments list based on the Title of the Annoucement list item.
Get Sort Filter from Click Next Test the page and you should see one annoucement and the related comment. In my next post we will create a form so that users can create new comments.
Pingback: Dave Cavins » Blog Archive » Adding Comments to a List Part 2
great post and it helped me a lot in commenting the videos in the video library……………….
@Rohit glad you found it to be useful.