Showing posts with label update many item in sharepoint list. Show all posts
Showing posts with label update many item in sharepoint list. Show all posts

Friday, November 18, 2011

Batch Updating List Items in Windows SharePoint

In Windows SharePoint Services 3.0, sometimes you must update multiple items in a list. Creating a foreach loop to iterate through a list item collection and performing an Update
 on each list item can be very intensive. An alternative approach is to 
construct a Collaborative Application Markup Language (CAML) string that
 contains a batch of commands to perform the updates and execute the 
commands by using the ProcessBatchData command of an SPWeb
 object. This Microsoft Office Visual How To demonstrates how to 
construct and execute a batch of commands to update text and date fields
 for all items in a list. 
 
// Set up the variables to be used.
StringBuilder methodBuilder = new StringBuilder();
string batch = string.Empty;
DateTime currentDate = DateTime.Now;
string formattedDate = SPUtility.CreateISO8601DateTimeFromSystemDateTime(currentDate);

Featured Posts

Kali Linux Remote Desktop: Access GNOME from Windows Using Native RDP

  Kali Linux + GNOME 50 + GNOME Remote Desktop + Windows Remote Desktop (MSTSC) Getting a full GNOME desktop remotely on Kali Linux can be ...