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.

Reference Architecture for AI-integrated Genomic Analytics on Oracle Cloud Infrastructure ( Published in Oracle Blog)

 I have been thinking about writing this blog for some time. Genomics is a fascinating field and has potential to unlock so many hidden scie...