Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

UpdateListItem() from Lists.asmx

$
0
0

I am writing a code for updating a list item using List.asmx web service's method updatelistItem()

Here is the batch paramater I am preparing:-

 SharePointLists.Lists obj = new SharePointLists.Lists();
            obj.Credentials = System.Net.CredentialCache.DefaultCredentials;
            obj.Url = "http://dev-apps:8000/applications/PA/_vti_bin/lists.asmx";
string strBatch = "<Method ID='1' Cmd='Update'><Field Name='DST'>989</Field><Field Name='PName'>Me</Field></Method>";
            XmlDocument xmlDoc = new System.Xml.XmlDocument();
System.Xml.XmlElement elBatch = xmlDoc.CreateElement("Batch");

            elBatch.SetAttribute("OnError", "Continue");
            elBatch.SetAttribute("ListVersion", "1");
            elBatch.SetAttribute("ViewName", " ");
            //elBatch.SetAttribute("ViewName","");

            elBatch.InnerXml = strBatch;
            try
            {
                XmlNode ndReturn = obj.UpdateListItems("List", elBatch);
                MessageBox.Show(ndReturn.OuterXml);
            }

the inner XML thus prepared is:-

- <Method ID="1" Cmd="Update"><Field Name="DST">989</Field> <Field Name="PName">Me</Field> </Method>

the outer XML returns this error:-

- <Results xmlns="http://schemas.microsoft.com/sharepoint/soap/">
- <Result ID="1,Update"><ErrorCode>0x8102000a</ErrorCode> <ErrorText>Invalid URL Parameter. The URL provided contains an invalid Command or Value. Please check the URL again.</ErrorText> </Result></Results>

What could be the reason?


Viewing all articles
Browse latest Browse all 11571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>