SharePoint中删除列表记录
方法1:
SPList spListQuestion = spWeb.Lists["Question List"];
for (int i = spListQuestion.Items.Count - 1; i >= 0; i--)
{ spListQuestion.Items[i].Delete(); }
方法2:
SPList spListQuestion = spWeb.Lists["Question List"];
string sDIDTitle = spListQuestion.Fields["DID"].InternalName;
SPQuery spQuery = new SPQuery();
spQuery.Query = "" + "" + spDocItem.ID.ToString() + "";
SPListItemCollection collListItems = spListQuestion.GetItems(spQuery);
for (int i = 0; i < collListItems.Count; i++)
{ string ID = collListItems[i]["ID"].ToString();
SPItem spItem = spListQuestion.GetItemById(Int16.Parse(ID));
spItem.Delete();
}