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)
Parsing Log/Text files
One of the team member was looking for ways to parse through logs to find errors in a big dump of files. I had to go to basics to get the r...

-
Note : In below scenario jenkins was deployed in Linux container Scenario: Jenkins build failed with error. java.io.IOException: error...
-
Ever wanted to have a people picker kind of control in Infopath form and that too in browser mode. Did i heard yes :) , well there is a Acti...
-
API manager showing up as "Unregistered " even after publishing the API to cloudhub Check out the setting of clientid and s...

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