Update Custom Columns From SharePoint 2010 via SOAP Web Services - UpdateListItems

Here’s a query to update a file’s custom columns in SharePoint 2010.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// Build the CAML Query
System.Text.StringBuilder oSb = new System.Text.StringBuilder();
oSb.Append("     <Batch OnError=\"Continue\" >");
oSb.Append("         <Method ID=\"1\" Cmd=\"Update\">");
oSb.Append("             <Field Name=\"ID\">" + fileID + "</Field> ");
oSb.Append("             <Field Name=\"Custom_x0020_Column\">" + customColumnText + "</Field> ");
oSb.Append("             <Field Name=\"Test_x0020_123\">" + test123Text+ "</Field> ");
oSb.Append("        </Method>");
oSb.Append("    </Batch>");

string sResult = oSb.ToString();
XmlDocument CAMLqueryXML = new XmlDocument();
CAMLqueryXML.LoadXml(sResult);

// Execute UpdateListItems
System.Xml.XmlNode result = lists.UpdateListItems(libraryName, CAMLqueryXML);