Problem Statement:
I want to add data into the "SalesReport" List on a sharepoint Site.
Solution:
Right click on the references folder and then ‘Add Web Reference…”.
WebService Reference: http://
Type in the url to sites webservice you wish to call in the next box,
give it an appropriate name (we have given it as SharePointkingsWebService ) and click ok.
Create a method and place the below code.
try
{
SharePointkingsWebService.Lists list = new SharePointkingsWebService.Lists();
list.Credentials = System.Net.CredentialCache.DefaultCredentials;
list.Credentials = new System.Net.NetworkCredential("SharePointkings", "Password", "SharePointkings");
XmlDocument doc = new XmlDocument();
XmlElement batch_element = doc.CreateElement("Batch");
string item = "" + " ";New " + "This is a test by Sharepoint Team " + "
batch_element.InnerXml = item;
list.UpdateListItems("SalesReport", batch_element);
return true;
}
catch (Exception ex)
{
return false;
}
....And the job is done!!!
1 comment:
How would you do this with a "Links" list?
Post a Comment