Reply to forum posts

To reply to a specific post from the thread you must perform the following:

To mark a thread as spam, you must perform the following:

  1. Get an instance of the manager.
    Get instance of the ForumsManager object.
  2. Create the post.
    For more information, see For developers: Create forum posts.
  3. Specify the reply-to post.
    Set the ReplyToPostId property of the ForumPost instance to the ID of the reply-to post.
  4. Save the changes.
    Save the changes to the manager.

Here is a code example:

C#
using System;
using Telerik.Sitefinity.Forums;
using Telerik.Sitefinity.Forums.Model;

namespace SitefinityWebApp
{
    public class ReplyToForumPosts_ReplyToPost
    {
        public void ReplyToPost(string postTitle, string postContent, Guid threadId, Guid parentPostId)
        {
            ForumsManager forumsManager = ForumsManager.GetManager();

            ForumPost post = forumsManager.CreatePost();

            post.Title = postTitle;
            post.Thread = forumsManager.GetThread(threadId);
            post.Content = postContent;
            post.LastModified = DateTime.UtcNow;

            post.IsPublished = true;

            post.ReplyToPostId = parentPostId;

            forumsManager.SaveChanges();

        }
    }
}
Want to learn more?
Enhance your Sitefinity skills by enrolling in free training sessions. Become Sitefinity certified through Progress Education Community to strengthen your professional credentials.
New to Sitefinity?