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 iterate through all the columns (default + custom) in Message content type in Discussion list.

i have used this code:

//select a single discussion (in this case, the first one), to view it's contentDiscussion
topic = (Discussion)dc.TeamDiscussion.Single(t => t.Id == 5);

//Get all the replies for the selected discussion
IEnumerable<Message> replies = 
   from reply in dc.TeamDiscussion.ScopeToFolder("/"+topic.Reply+"/"+topic.Title, false)                               
   select (Message)reply;

How can I iterate through the IEnumerable replies? I do not want to use CAML.

Please Suggest best possible way to get the results through LINQ

share|improve this question
Did you try foreach (Message reply in replies) { } ? – Brandon Jul 5 '12 at 13:53

As far as I know, the Discussion list work the following way:

List.Items -> Message ContentType

List.Folders -> Discussion ContentType

So to get the Replies, search in the List.Items.

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.