Prasad Bolla's SharePoint Blog

Click Here to go through the Interesting posts within my Blog.

Click Here to go through the new posts in my blog.

Monday, November 28, 2011

Insertion Using SharePoint Default Webservices

string strInsertCommand = string.Empty;
strInsertCommand = "" + txtUserName.Text + "" + txtPassword.Text + "";
InsertSampleService.Lists objLogin = new InsertSampleService.Lists();
objLogin.UseDefaultCredentials=true;
objLogin.Url = "http://vlnrm:100/_vti_bin/Lists.asmx";
string strListName = "Test";
XmlDocument xmlDoc = new System.Xml.XmlDocument();

System.Xml.XmlElement elBatch = xmlDoc.CreateElement("Batch");

elBatch.SetAttribute("OnError", "Continue");

elBatch.SetAttribute("ListVersion", "1");

elBatch.InnerXml = strInsertCommand;

XmlNode ndReturn = objLogin.UpdateListItems(strListName, elBatch);

string result = ndReturn.OuterXml.ToString();
txtUserName.Text = "";
txtPassword.Text = "";
txtUserName.Focus();

No comments:

Post a Comment