I have a custom sharepoint list called VSList, from which I can retrieve all items (4 columns altogether) using the following code:
string siteUrl = url2;
ClientContext clientContext = new ClientContext(siteUrl);
SP.List oList = clientContext.Web.Lists.GetByTitle("VSList");
CamlQuery camlQuery = new CamlQuery();
ListItemCollection collListItem = oList.GetItems(camlQuery);
clientContext.Load(collListItem, items => items.Include(item => item["Title"], item => item["qf2a"], item => item["_x0077_830"], item => item["u6zl"]));
clientContext.ExecuteQuery();
Is there any way to reverse it somehow, so I can upload data, and not download it? Thanks in advance.!
This is fairly simple to do with the following code (edited my code to fit your list).
// Open client context to the site
var clientContext = new ClientContext(siteUrl);
// Use client context to open the list
var oList = clientContext.Web.Lists.GetByTitle("VSList");
var listCreationinformation = new ListItemCreationInformation();
var oListItem = oList.AddItem(listCreationinformation);
// Push information to individual tables in the selected list
oListItem["Title"] = value1;
oListItem["qf2a"] = value2;
oListItem["_x0077_830"] = value3;
oListItem["u6zl"] = value4;
oListItem.Update();
clientContext.ExecuteQuery();
To get a better overview on how to do this see - How to: Create, Update, and Delete List Items
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.