檢索列表項
using (SPSite site = new SPSite("http://server/sites/siteCollection"))
using (SPWeb web = site.OpenWeb())
{
SPList list = web.Lists["Some list"];
// It is always better and faster to query list items with GetItems method with
// empty SPQuery object than to use Items property
SPListItemCollection items = list.GetItems(new SPQuery());
foreach (SPListItem item in items)
{
// Do some operation with item
}
}