Clear short term file lock in SharePoint 2013+ - Fabian Neve

About SharePoint, Javascript, PowerShell, and other technical stuff

Friday, February 9, 2018

Clear short term file lock in SharePoint 2013+

If a file is locked by a user who doesn't work on it anymore (he closed the file already more than 10 minutes ago) it can happen that the file is still locked.



Here a script to unlock the file:


If you get an error like:

Exception calling "ReleaseLock" with "1" argument(s): "The file filename.xlsx is locked for exclusive use by DOMAIN\user"

...then try next script to use impersonation. This happens when a user left the file open and nobody else is able to edit the file in his absence.


Found those great and absolutetly useful scripts at Stackexchange where you get more informations about short term file lock.