Let's discuss how we can insert bulk records in sharepoint? I have an requirement to upload some thousands of records to sharepoint list.This functionality we can not achieve using SPListItem.Add().So I go for batch
processing method.
e.g.
StringBuilder sbReturnBatch = new StringBuilder();
sbReturnBatch.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?><Batch>");
sbReturnBatch.Append(string.Format("<Method><SetList Scope=\"Request\">{0}
</SetList>" +"<SetVar Name=\"ID\">New</SetVar>" +
"<SetVar Name=\"Cmd\">save</SetVar>" +
"<SetVar Name=\"urn:schemas-microsoft-com:office:office#Title\">123</SetVar>" +
"<SetVar Name=\"urn:schemas-microsoft-com:office:office#FieldName\">value</SetVar>"
+"</Method>", listID, );
sbReturnBatch.Append("</Batch>");
string strReturn = SPWeb.ProcessBatchData(sbReturnBatch.ToString());
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment