Tuesday, November 04, 2008

Get Discussion List Items from SharePoint Discussion Forum

If you are trying to retrieve all the root items of the Discussion List this way , it's not going to work :
SPSite site = new SPSite("Site URL");
SPWeb web = site.OpenWeb();
SPList list1 = web.Lists["DiscussionListName"];

SPListItemCollection coll = list1.Items ;



Well Here is the right way of doing it :-)
SPSite site = new SPSite("Site URL");
SPWeb web = site.OpenWeb();
SPList list1 = web.Lists["DiscussionListName"];
SPListItemCollection coll =list1.Folders ;

1 comment:

Anonymous said...

Thank you! I was going crazy looking for this.

Gray Failures: What is it and how to detect one?

If you are reading this article , i guess you are curious to know about gray failures and different methods to detect gray failures.  Hopefu...