using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint.Client;
using SP = Microsoft.SharePoint.Client;
namespace MYItemUpdate
{
class Program
{
static void Main(string[] args)
{
getfiles();
}
private static void getfiles()
{
ClientContext clientContext = new ClientContext("http://server- sp:6677/sites/HRDocuments/");
clientContext.Credentials = new System.Net.NetworkCredential("username1", "pass@1234","myDomineName1");
List list = clientContext.Web.Lists. GetByTitle("Shared Documents");
CamlQuery camlQuery = new CamlQuery();
camlQuery.ViewXml = @"<View Scope='Recursive'></View>";
camlQuery. FolderServerRelativeUrl = "/sites/HRDocuments/Shared Documents/Pay Slips";
SP.ListItemCollection listItems = list.GetItems(camlQuery);
clientContext.Load(listItems);
clientContext.ExecuteQuery();
SP.ListItem itemOfInterest = listItems[0];
Console.WriteLine( itemOfInterest["Employee_ x0020_ID"].ToString());
itemOfInterest["Employee_ x0020_ID"] = "66";
itemOfInterest.Update();
clientContext.ExecuteQuery();
listItems = list.GetItems(camlQuery);
clientContext.ExecuteQuery();
}
}
}
No comments:
Post a Comment