The following code compiles with no errors:
ListsWebServices.Lists listService = new ListsWebServices.Lists();
listService.Credentials = System.Net.CredentialCache.DefaultCredentials;
listService.Url = "http://toplevel/OC/coldrooms/_vti_bin/lists.asmx";
System.Xml.XmlNode ndListView = listService.GetListAndView("Test", "");
string strListID = ndListView.ChildNodes[0].Attributes["Name"].Value;
string strViewID = ndListView.ChildNodes[1].Attributes["Name"].Value;
System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
System.Xml.XmlElement batchElement = doc.CreateElement("Batch");
batchElement.SetAttribute("OnError", "Continue");
batchElement.SetAttribute("ListVersion", "1");
batchElement.SetAttribute("ViewName", strViewID);
batchElement.InnerXml = "<Method ID='1' Cmd='New'>" +
"<Field Name='ID'>New</Field>" +
"<Field Name='User'>MR ANDERSON</Field>" +
"</Method>";
try
{
listService.UpdateListItems(strListID, batchElement);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
But does not add any new item to the List, I have confirmed that it gets the right GUID's by opening the list in sharepoint designer and cross referencing. Any advice as to where I am going wrong would be greatly appreciated.