How we can get forum' post tree structure using custom code?

Shubham Salaria asked on February 13, 2018 13:13


I need to get all tree node for a specific forum' post. I'm able to get all forum's post using below code in my custom APIInfoDataSet<ForumPostInfo> posts = ForumPostInfoProvider.GetForumPosts(where, OrderBy);.

Below two things I need to do to accomplish my task

  1. how to get URL of specific Forum's post or any way to build separately and that URL also increment the PostView property.
  2. How to get tree structure of specific forum's post.

Any help appreciated.

Thanks Shubham

Recent Answers

Juraj Ondrus answered on February 14, 2018 08:30

I would recommend checking the Forum_* DB tables to see what columns are there and what data are stored. Then, these columns can be used in the condition to get the posts you want (take inspiration from the API examples on working with forum posts)
To built the URL, you can use the PostIDPath column and its values - it tells the ID of the parent post.

0 votesVote for this answer Mark as a Correct answer

Shubham Salaria answered on February 14, 2018 08:40

Thanks Juraj Ondrus for your reply.

Actually after posting here I finished the first part which is to get specific post. I'm using PostID in my custom API to get all details. But I'm not able to get all replies to that post in hierarchical tree structure. Can you please help me in that


0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on February 14, 2018 21:10

If you're able to get the PostID, you should be able to modify your query to get all children of that PostID looking at the PostIDPath very similar to how you'd look a pages children by their alias path.

All children of About Us page: /About-Us/%
All children of post 45 in forum 1: /00000045/%
All children to a response on post 45 in forum 1: /00000045/00000068/%

1 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.