Advertisement
In this article we are able to see how to update list items
in SharePoint using client object model, without changing the modified user
name and time in this sample example.
using Microsoft.SharePoint.Client;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
namespace updatefieldvalues
{
class Program
{
static void Main(string[] args)
{
ClientContext context = new ClientContext("SiteName");
context.Credentials = new NetworkCredential("UserName", "Password", "DomainName");
context.Load(context.Web);
List list = context.Web.Lists.GetByTitle("ListName");
context.Load(list);
string oldvalue = "OldValue";
string newvalue = "NewValue"
CamlQuery cQuery = new CamlQuery();
cQuery.ViewXml = "<View><Query><Where><Eq><FieldRef Name='OldFieldName'/><Value Type='Text'>" + oldvalue +
"</Value></Eq></Where></Query></View>";
ListItemCollection ListItemCollection = list.GetItems(cQuery);
context.Load(ListItemCollection);
context.ExecuteQuery();
foreach (var item in ListItemCollection)
{
item["NewFieldName"] = newvalue;
item["Editor"] = item["Editor"];
item["Modified"] = item["Modified"];
item.Update();
}
context.ExecuteQuery();
}
}
}
SharePoint Online Real Time Training
Contact: JLAKSHMITULASI@GMAIL.COMusing System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
namespace updatefieldvalues
{
class Program
{
static void Main(string[] args)
{
ClientContext context = new ClientContext("SiteName");
context.Credentials = new NetworkCredential("UserName", "Password", "DomainName");
context.Load(context.Web);
List list = context.Web.Lists.GetByTitle("ListName");
context.Load(list);
string oldvalue = "OldValue";
string newvalue = "NewValue"
CamlQuery cQuery = new CamlQuery();
cQuery.ViewXml = "<View><Query><Where><Eq><FieldRef Name='OldFieldName'/><Value Type='Text'>" + oldvalue +
"</Value></Eq></Where></Query></View>";
ListItemCollection ListItemCollection = list.GetItems(cQuery);
context.Load(ListItemCollection);
context.ExecuteQuery();
foreach (var item in ListItemCollection)
{
item["NewFieldName"] = newvalue;
item["Editor"] = item["Editor"];
item["Modified"] = item["Modified"];
item.Update();
}
context.ExecuteQuery();
}
}
}
60AAA502B9
ReplyDeletesteroid fiyatları
whatsapp ÅŸov
steroid satın al
ReplyDeleteSosyal medya hesaplarınızın etkileşimini artırmak için güvenilir bir smm panel kullanmanız önemlidir. Bu panel sayesinde hızlı ve güvenli bir şekilde takipçi ve beğeni artırabilirsiniz. Ayrıca ihtiyaçlarınıza uygun çeşitli paketler sunarak sosyal medya stratejinizi güçlendirmeyi hedefler. Doğru seçim yaparak hesaplarınızın görünürlüğünü artırabilirsiniz.