Here’s a code snippet for checking the Xml result returned from Sharepoints UpdateListItems() Lists webservice method.
private static KeyValuePair<int, string> CheckListUpdateResults(XmlNode resultsNode)
{
if (resultsNode == null) return new KeyValuePair<int, string>(0, "Null results node supplied");
XmlNamespaceManager ns = new XmlNamespaceManager(resultsNode.OwnerDocument.NameTable);
ns.AddNamespace("sp", resultsNode.NamespaceURI);
var errorCode = resultsNode.SelectSingleNode("//sp:ErrorCode", ns).InnerText;
if (errorCode == "0x00000000")
{
// grab the list item ID
var owsID = resultsNode.SelectSingleNode("//@ows_ID").Value;
return new KeyValuePair<int, string>(Convert.ToInt32(owsID), null);
}
var errorText = resultsNode.SelectSingleNode("//sp:ErrorText", ns).InnerText;
var result = new KeyValuePair<int, string>(0, string.Format("Error {0}, {1}",
errorCode ?? "n/a",
errorText ?? "n/a"));
return result;
}
RSS - Posts
My