Showing posts with label Insert. Show all posts
Showing posts with label Insert. Show all posts

Monday, June 11, 2012

SharePoint Batch Insert/Update/Delete Performance

When you want to do bulk transaction insert, update, or delete.
If you have to update a larger number of items its highly recommended to not use the Update method on every item. Instead – use the batch update function ProcessBatchData provided by SPWeb.

StringBuilder query = new StringBuilder();
for (int itemIx=0;itemIx<100;itemIx++) {
  query.AppendFormat("" +
          "{1}" +
          "New" +
          "Save" +
          "{2}" +
       "", i, listGuid, someValue, "urn:schemas-microsoft-com:office:office#");
}
SPContext.Current.Web.ProcessBatchData("" +
    "{0}", query.ToString())

For more details of using ProcessBatchData check url:
http://stefan-stanev-sharepoint-blog.blogspot.com/2009/07/tips-for-using-spwebprocessbatchdata.html


Sunday, June 10, 2012

Update PublishingImages using list.asmx

It takes from me too long time before success update PublishingImage Column using list.asmx.
We should pass value relative url with alt separated by comma. This is also applied for url, lookup, or user.
Check example below:
 string xml = ""+
        ""+
        "    1"+
        "    http://www.pub.com/publishingimages/test.jpg, test"+
       
"+

"       ";