SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to show a particular thread that resides in a discussion board. I am currently trying to use SPViews.

The following is my code

            SPView threadedView = discussionBoard.Views["Threaded"];
        threadedView.Title = "Comments WebPart";

        //threadedView.Query = query.ToString();

however this view is giving me all the discussion threads in the discussion board not a single thread which is needed. tried also to set a query for the view but was useless. can anyone help pls.

share|improve this question
up vote 2 down vote accepted

You should treat Discussions as Folders and Threads as plain items. Basically the content types are Discussion (which inherits from Folder) and Message. Afterwards the best is to use SPQuery to retrieve the Items or simple GetItemById on the list to retrieve your item.

The Message has a field as follows <Field ID="{7662cd2c-f069-4dba-9e35-082cf976e170}" Type="Note" RichText="TRUE" RichTextMode="FullHtml" IsolateStyles="TRUE" NumLines="15" Name="Body" DisplayName="$Resources:core,camlid2;" Sortable="FALSE" AllowDeletion="FALSE" SourceID="" StaticName="Body"> </Field> which returns the full content of it. Just retrieve it.

Hope it helps, C:\Marius

share|improve this answer

If this is in a webpart or usercontrol and you want to show the view in an aspx page, then you just need this code and then pass in the url parameter ?RootFolder=... and this will give you all the messages under this discussion.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.