I have the following code, which I use to check out a file from my Document Library:
var ctx = new ClientContext("http://sharepoint/mysite"); var web = ctx.Web; var file = web.GetFileByServerRelativeUrl("mysite/documentlibrary/filename.pdf"); file.CheckOut(); ctx.ExecuteQuery();
This code appears to work on most occasions, but sometimes when calling it I get this error message on the last line:
"The file 'http://sharepoint/mysite/documentlibrary/filename.pdf' is not checked out."
When I navigate to the file in a browser, I can see that the file is indeed not checked out, but the error is not helpful at all as that is what I am trying to do!
I am also unable to check the file out manually from the browser with the same message.
Does anyone know what might be happening here?