C# – Access list data through SharePoint Web Part

csharepointweb-parts

I'm building a custom web part in SharePoint 2007. It needs to access specific list item data and then format and style the output.

I'm developing the web part in C#, and would like the solution to be self-contained. How do I access list data from this web part? Can I use a SOAP request and process it in C#? Should I be pulling list data through a web service (such as getlistitems)?

Best Answer

Since you're building a SharePoint Web Part, you should access the list and its data via the SPList class.

The linked document provides a short example of how to properly get a list from the current SharePoint site.

Related Topic