You might end up with this requirement quite often and and try top down approach for delete :
for (int count=0;count < itemCount ; count++)
{ itemcoll[count].Delete(); }
and bump into exceptions , well the other way to do it is bottom up delete
for (int count =itemCount-1 ; count>0 ; count--)
{ itemcoll[count].Delete(); }
Subscribe to:
Post Comments (Atom)
Gray Failures: What is it and how to detect one?
If you are reading this article , i guess you are curious to know about gray failures and different methods to detect gray failures. Hopefu...
-
Note : In below scenario jenkins was deployed in Linux container Scenario: Jenkins build failed with error. java.io.IOException: error...
-
SharePoint Capacity Planning Tool on Microsoft Download Center: http://go.microsoft.com/fwlink/?LinkID=93029 System Center Capacity Planner:...
-
Simple concept but still pain in head if unable to figure out :) Response.Redirect("#");
2 comments:
Try this too,
Delete item from SharePoint List and more
Updated Code - Removes All Items
int itemCount = list.ItemCount;
SPListItemCollection itemcoll = list.Items;
//iterate & delete items
for (int count = itemCount - 1; count >= 0; count--)
{
itemcoll[count].Delete();
}
list.Update();
Post a Comment