can you please advise me as how to create checkin checkout functionality in file under document library using client object model in SharePoint 2010
thanks kajal
can you please advise me as how to create checkin checkout functionality in file under document library using client object model in SharePoint 2010
thanks kajal
Everytime you do createion, deleteion or updating metadata in SharePoint Files,
you are suggested to do check out before the operation and check in after the operation.
=======================================
//Check Out
clientContext = new Microsoft.SharePoint.Client.ClientContext("Your site here");
clientContext.Credentials = new NetworkCredential("LoginID","LoginPW", "LoginDomain");
clientContext.Load(clientContext.Web);
Microsoft.SharePoint.Client.Web web = clientContext.Web;
Microsoft.SharePoint.Client.File f = web.GetFileByServerRelativeUrl("relative path to the file");
f.CheckOut();
clientContext.ExecuteQuery();
//....... Your operation...............
//Check in
clientContext.Credentials = new NetworkCredential("LoginID","LoginPW","LoginDomain");
clientContext.Load(clientContext.Web);
Microsoft.SharePoint.Client.Web web = clientContext.Web;
Microsoft.SharePoint.Client.File f = web.GetFileByServerRelativeUrl("relative path to the file");
f.CheckIn(String.Concat("File CheckingIn at ", DateTime.Now.ToLongDateString()),
Microsoft.SharePoint.Client.CheckinType.MajorCheckIn);
clientContext.ExecuteQuery();