sharepoint - Deleting list items via ProcessBatchData() -


You can create a batch string to delete all items from a SharePoint list like this: Pre> 1: // Create a new stringbuilder: stringbilder batchstring = new stringbilder (); 3: 4: // StringBiltter 5: add main text to batch string. (""); 6: 7: // Add each item in the batch string and delete it command 8: Fresh (SPLIT item in item collection) 9: {10: // Create a new method section 11: batchstring.change (""); Find out from the 12: // list: How to remove from 13: Batchstring.change ("" + + Convert.trustring (item.partent.id +) ""); 14: // to delete item 15: batchstring.change ("" + convert.tostring (item.id) + ""); 16: // Set the action that you want to do in the first 17: batchstring.parad ("delete"); 18: // Close the Law Section 19: Batchstring.epend (""); 20:} 21: 22: // Close the batch section 23: Batchstring.Pend (""); 24: 25: // Make Batch 26 first: SPContext.Current.Web.ProcessBatchData (BatchString.Testring ());

The only disadvantage I can think of right information is that all items you delete will be inserted into the Recycle Bin. How can I stop it?

I also got the solution as below:

 // Web is an SP Web object that relates to your lists. Webapp RecycleBinEntrated = false; // When you are finished it can re-enable the web. Site. Web app. Recyclables enabled = true; Referee [here] (http://www.entwicklungsgedanken.de/2008/04/02/how-to-speed-up-the-deletion-of-large-amounts-of-list-items-with-sharepoint/) 

But the disadvantage of that solution is that only deletion in the future will not be sent to the recycle bins, but it will also remove all existing items that users do not want. Any ideas to stop uninstalling existing items?

Many thanks in advance,

TQT

me It is possible that bypassing the Recycle Bin by using the batch update it is possible, but you can modify the code to do something like this

  foreach (itemcollection in SPListItem item) {Item .elete (); // If you do not need to re-send it to the Recycle Bin / or Recycle Bin, then you can use the item. Recycle (); }  

Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -