I was working on adding/deleting list items using web services. When we have to delete the SPListItem from a document library/list, it is mandatory to mention ID of that SPListItem.
Ex.,
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiDpweG5w_Nkl1U1a6J_zN_zaRfRQIfDek2oWENWQVNCA00GAmlrPwjP_V9at5LMVLtcug2y1b-Qj9JgM1UMX7_LB22aOQdaJAID2prQunQi8Nl60IiGicM2F126lNN6hkGmticjQ1xEXkD/s400/ws1.JPG)
I cannot do something like this:
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhoHY8Ur8aATmXNHXKuHo4ADC-o56qKxj16g1-abqh3ZJM0z5QMdEyySNK0k9av0Evuc5ZNJiTV9yXSyi34pyh-oXEyiMfwhBXOHTxWFa_sOc0kin6xjqr0hbLytY1IOQT72prCOlXcOhP0/s400/ws2.JPG)
This way of coding would have helped more:
First, I would like to delete all the list items where City="Bengaluru".
Second, many a times we do not expose ID column for the user. So, we would be interested only in those columns which matters.
As a workaround, I had to use GetListItems to get the SPListItems where City = "Bengaluru" and then for each ID, execute UpdateListItems to delete those SPListItems.
Ex.,
I cannot do something like this:
This way of coding would have helped more:
First, I would like to delete all the list items where City="Bengaluru".
Second, many a times we do not expose ID column for the user. So, we would be interested only in those columns which matters.
As a workaround, I had to use GetListItems to get the SPListItems where City = "Bengaluru" and then for each ID, execute UpdateListItems to delete those SPListItems.
Comments
Post a Comment