.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Sandeep Singh
Melody Anderson
Eminent IT

Home >> Code Snippets >> SharePoint >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Update Custom List item: Sharepoint web services using javscript

Posted By:Sagar Pardeshi       Posted Date: November 11, 2013    Points: 40    Category: SharePoint    URL: http://www.dotnetspark.com  

Update Custom List item: Sharepoint web services using javscript

<script type="text/javascript">
function update()
  var UpdateNewItemXml= "<Batch OnError='Continue' ListVersion='1'>" 

                                                                        + "<Method ID=\"1\" Cmd=\"Update\">" 

                                                                        + "<Field Name='ID'>2</Field>"
                                                                        + "<Field Name='Name'>Mack</Field>"

                                                                        + "</Method>" 

                                                                        + "</Batch>";
                                                                       FeedbackHTTP = new ActiveXObject("MSXML2.XMLHTTP.3.0");
                                                                       FeedbackHTTP.Open("POST", "http://spsrvr:800/sites/test/_vti_bin/lists.asmx", false);
                                                                        FeedbackHTTP.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
                                                                        var strSOAP = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" 
                                                                 +"<soap:Envelopexmlns:xsi=\"http://www.w3.org/2001/XMLSchemainstance\"xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" 

                                                                        + "<soap:Body>" 

                                                                        + "<UpdateListItems xmlns=\"http://schemas.microsoft.com/sharepoint/soap/\">" 

                                                                        + "<listName>MyList</listName>" 

                                                                        + "<updates>"+ UpdateNewItemXml + "</updates>" 

                                                                        + "</UpdateListItems>"

                                                                        + "</soap:Body>"

                                                                        + "</soap:Envelope>";



                                                                        alert("Thank you! your suggestion has been Updated successfully.");



Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend