user576510
user576510

Reputation: 5915

deleting sharepoint list item from listview?

I have get all items of a share-point list. Requirement is to delete list items form listview. Plz guide me how it can be done ?

I have idea that it can be done by using checkbox in listview.

I am not getting how to get checked items in listview and how to delete checked items from share point list ?

Upvotes: 0

Views: 1341

Answers (2)

Alexei Levenkov
Alexei Levenkov

Reputation: 100630

And if you are using SharePoint 2010 you can use client Object Model - here is howto for exactly your sceanrio: http://msdn.microsoft.com/en-us/library/ee539976.aspx

Johnv2020 answer shows 2 other ways of doing it:

  • if you can/need to use server side code use regular SahrePoint object model (http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splistitemcollection.delete.aspx - for SharePoint 2010 version, page also contain link to same method in previous version - Windows SharePoint Service 3/MOSS 2007).
  • If you need to talk to older version of SharePoint from clinet (browser or client application) - use WebService - http://msdn.microsoft.com/en-us/library/cc824213(v=office.12).aspx

Upvotes: 1

Johnv2020
Johnv2020

Reputation: 2146

You can just use the SPListItemCollection.Delete method (assuming you're using the api). If not then use can use Lists.asmx to delete. For example ssomething like the code below will work

SPWeb mySite = SPContext.Current.Web;
SPListItemCollection listItems = mySite.Lists["List1"].Items;
SPListItem item = listItems[k];
listItems.Delete(k);

Upvotes: 1

Related Questions