A website created by using a Sharepoint site template, such as a team site, contains the announcement (Announcement) function. By default, users cannot comment on announcement items. In fact, it is the same for all the custom lists created by default, and there is no way to add comment. So in some scenarios where user comment is required, it is depressing.
Fortunately, there is a blog website template in the site template. The site created through it contains the blog and the function of posting comments to the blog. Look at the structure of the blog and find:
- The blog function consists of two lists: posts and comments.
- The two lists use the lookup field post id (this is a hidden field, and I do not know how to generate it. The list setting page cannot be seen, and the SharePoint object mode must be used for editing.CodeView) post title is connected, and the blog and the corresponding comment are displayed on the page through the view written by caml.
Then there is a way to add a comment to announcement:
1. Create a list to store comments, such as announcement comments.
2. Add fields to the comment list:
- Nickname-single line of text
- Body-multiple lines of text
- Post ID-Lookup(This field is required and connected to announcements-> ID)
3. Use designer to open displayform. aspx of announcements. In general, all comments should be listed in the announcement text, and a tool for adding new comments should be provided at the bottom. Now there are two parts in the body. here we need to add two new Web parts, one for displaying all comments, and the other for adding new comments.
4. For simplicity, we add two new webparts on the page (so we don't have to generate the webpart ID on our own) and then modify the two webparts. The actual operation is as follows:
- Open an announcement and addDisplaymode = DesignFor example, http: // localhost: Port // lists/announcements/dispform. aspx? Id = 8 & source = XXXXX &Displaymode = Design