I'm developing a Word VSTO so, when a user opens a document from Sharepoint and presses a button, the code should create a major version. The code is:
Globals.ThisAddIn.Application.ActiveDocument.Close();
.....
Microsoft.SharePoint.Client.File file = web.GetFileByServerRelativeUrl(fileServerRelativeUrl);
ctx.Load(file);
ctx.ExecuteQuery();
file.CheckIn("updated by user: "+Environment.UserName, CheckinType.MajorCheckIn);
file.Update();
ctx.ExecuteQuery();
I get an error: The file http://myserver/Firm_/fillee11.docx
is locked for shared use by ADname\the_same_user_whois_loggedOntoPC
.
So, what is the proper way to check in the file?