The following code example shows how to use the InstantForum .NET API to add a new topic within an existing forum and then add a new reply to this new topic. For further information on obtaining the forum API programmatically please see our Forum API section.
You'll need to first reference the InstantForum assemblies and then add the necessary using or import statements to your class. For this example you'll simply need to use InstantASP.InstantForum as shown below...
Please note this example was prepared with InstantForum 2017 and above. If you're using an earlier version of InstantForum the API may differ. Don't hesitate to contact support for an example specific to the version of InstantForum you're using.
// get current user object
var currentUser = HttpContext.ForumContext.Current.CurrentUser;
// pass current user into the construcotr for our post object
// this is important as this user object is used as the author of the post
var post = new Business.Posts(currentUser);
var newTopic = post.InsertUpdatePost(new Components.Topic()
ForumID = 3,
Title = "My New Topic",
Message = "My New Post Text"
// did InsertUpdatePost return a topic object?
if (newTopic != null)
// let's add a reply to our new topic
var newReply = post.InsertUpdatePost(new Components.Topic()
ForumID = 3,
TopicID = newTopic.PostID, // REQUIRED - to ensure this is added as a reply to our topic
ParentID = newTopic.PostID, // OPTIONAL - only used for threaded view
Message = "My New Reply Text"
We hope this simply example helps you integrate InstantForum within your applications. As always if we can assist further or provide any additional examples please never hesitate to submit a support request.