Click here to Skip to main content
15,881,811 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I want to update share point list programatically.
I got the code and its working in my local machine.
Now i want to do the same in production.
But here the problem is , in my local site code taking the default system user name and password.
But in production i want pass username and password to add items in that sharepoint site.
how to do this?
below is my code

ClientContext clientContext = new ClientContext(siteUrl);
SP.List oList = clientContext.Web.Lists.GetByTitle("listname");//Share point List name

ListItemCreationInformation itemCreateInfo = new ListItemCreationInformation();
ListItem oListItem = oList.AddItem(itemCreateInfo);

//Adding list items
oListItem["Name"] = "help me plz";
oListItem["Age"] = "25";

oListItem.Update();
clientContext.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;// what i have to do here ??????????
clientContext.ExecuteQuery();
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900