Thursday, July 23, 2009

Deleting SPListItem using Web Service

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.,


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.

0 comments:

Post a Comment