Gunnar Peipman's ASP.NET blog

ASP.NET, C#, SharePoint, SQL Server and general software development topics.






SharePoint for Developers: 3.2 Hands-on - getting list items

To read data from list we have to get reference to list first. SPWeb has lists collection we can use to find the list we are interested in. Following code example shows how to get instance of list.


NB! This blog is moved to

Click here to go to article


DigiMortal said:

Thank you, Vince, for your reply. I will handle querying in the next entry of this serie. Also I will there that querying is normal way to get data and why it is good plan to avoid using full size item collections.

# September 28, 2008 4:15 AM

Wictor said:

I agree with Vince. Using SPQuery/CAML is the correct way of getting items from a list, your code might look a bit overkill - but the performance increase is overwhelming.

We recently ran into performance trouble, which was not present during the test phase, and the reason was that one of our list which we foreached over had grown to about four times it's size - a quick switch to a simple CAML question solved it, and even made it perform better than ever.


# September 29, 2008 3:07 AM

Pradeep said:

Crisp and easy to digest posts.

# October 5, 2008 12:30 PM

MM said:

Lets say that items 1,2 are returned. On the website, when you click item 1, it opens up another page with the item details. How do we get to the details once we have the list ?

# March 28, 2011 5:07 PM

ps123 said:

Hi ,

i want copy list items to share point library .both list & Lib same site .pls send me code

# January 4, 2012 6:48 AM