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)
Design a Zero Trust pipeline using Confidential Computing
Check out reference diagram to design a zero trust pipeline https://blogs.oracle.com/cloud-infrastructure/designing-zero-trust-and-resilie...
-
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...
-
Am sure lot's of people would be wondering how to hide menu items of a list eg document libraries "Send to " menu item . In o...
-
I got this error for quite some time and i had no clue what was wrong in my page . Page consisted of only 2 panel controls . That's all ...
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