I am not able checkin/checkout the files in sub folders in the document library using client object model. Below is the code I am using.
public void CheckOut()// CHECK OUT FUNCTION
{
try
{
string siteurl = "";
string filePath = "";
ClientContext context = new ClientContext(siteurl);
context.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;
Web web = context.Web;
File file = web.GetFileByServerRelativeUrl(filePath);
file.CheckOut();
context.Load(web);
context.Load(file);
context.ExecuteQuery();
if (file.CheckOutType == CheckOutType.None)
{
file.CheckOut();
}
context.Load(file);
context.ExecuteQuery();
}
catch (Exception ex)
{
}
}
public void Checkin()// CHECK-IN FUNCTION
{
try
{
string filePath = "";
ClientContext context = new ClientContext("");
context.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;
Web web = context.Web;
File file = web.GetFileByServerRelativeUrl(filePath);
// file.CheckIn();
file.CheckIn(string.Empty, CheckinType.MajorCheckIn);
context.Load(file);
context.ExecuteQuery();
}
catch (Exception ex)
{
}
}