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:

Microsoft.SharePoint.Client.File file = web.GetFileByServerRelativeUrl(fileServerRelativeUrl); 
file.CheckIn("updated by user: "+Environment.UserName, CheckinType.MajorCheckIn);

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?

1 Answer 1


When the file is opened from SharePoint directly via any of the office application, SharePoint locks the file for short term. The lock is released automatically by SharePoint after certain duration (idle timeout). There is a server side API - "ReleaseLock" that can be used to explicitly release the lock.

No client side/REST API is available as of now for this.

You can vote to suggest this feature below:-


Please refer thread discussing server side implementation of this below:-

Clearing short term file lock


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.