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

  • Did you try foreach (Message reply in replies) { } ?
    – Brandon
    Commented Jul 5, 2012 at 13:53

1 Answer 1


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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