I use the following code to add an item to a SP list, usign web services:
XmlNode returnValue = lists.UpdateListItems("Facturas", batchElement);
XmlNodeList errors = returnValue.SelectNodes("/Results");
if (errors.Count != 1)
{
Console.WriteLine("errors.Count es " + errors.Count);
Console.ReadKey();
return -1;
}
Console.WriteLine("Error " + errors[0].Value + " -> " + int.Parse(errors[0].Value));
errors.OuterXml return the following XML(the attributes of z:row have been omitted)
<Results xmlns="http://schemas.microsoft.com/sharepoint/soap/">
<Result ID="1,New" xmlns="http://schemas.microsoft.com/sharepoint/soap/">
<ErrorCode>0x00000000</ErrorCode>
<ID />
<z:row ows_ContentTypeId="0x010031045FE2D0730F499569DE68AFDB3F0B" ... xmlns:z="#RowsetSchema" />
</Result>
</Results>
When I run the code, I always get that errors.Count is 0. I have tried the following arguments to the SelectNodes method:
ErrorCode
//ErrorCode
/Results
Results
*[local-name() = 'ErrorCode']
/*[local-name() = 'Results']
Also, I changed my code to:
XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable);
nsmgr.AddNamespace("soap", "http://schemas.microsoft.com/sharepoint/soap/");
nsmgr.AddNamespace("rs", "urn:schemas-microsoft-com:rowset");
nsmgr.AddNamespace("z", "#RowsetSchema");
XmlNode returnValue = lists.UpdateListItems("Facturas", batchElement);
XmlNodeList errors = returnValue.SelectNodes("soap:ErrorCode", nsmgr);
and did not get anything wile querying for soap:ErrorCode or rs:ErrorCode.