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

Updating a Record basedon ItemID using SharePoint default WebService

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using PrasadBolla3;
using System.Xml;

public partial class Default8 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}

protected void btnUpdate_Click(object sender, EventArgs e)
{
string strUpdateCommand = string.Empty;
strUpdateCommand = "" + ddlItemID.SelectedItem.Value +"" + txtUserName.Text + "" + txtPassWord.Text + "";
PrasadBolla3.Lists objLogin = new PrasadBolla3.Lists();
objLogin.Credentials = new System.Net.NetworkCredential("true_indian9000", "prasad1234", "apptix");
objLogin.Url = "http://prasad.bolla3.sharepointsite.net/_vti_bin/Lists.asmx";
string strListName = "Login";
XmlDocument xmlDoc = new System.Xml.XmlDocument();

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

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

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

elBatch.InnerXml = strUpdateCommand;

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

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

No comments:

Post a Comment