I have a SharePoint Designer workflow which runs on new files in a library, and renames them automatically. Before the file is renamed, the workflow waits until the file is checked in by looking at its Checkout
property, and waiting in a loop if this is not empty.
If I upload a file to the library, I'm able to complete the required fields in its properties and check it in successfully. However, if I use the New button at the top of the list to create a new document, things go wrong.
The file is opened in the O365 online online client (eg Excel) and I am able to edit it. When I return to the library and attempt to edit the properties of the document, I receive the "The file is locked for exclusive use by..." error. The same happens if I try to re-open the file, either in the online or desktop client. After 10 minutes, the lock is released as described in this answer, and I can continue working with the file.
I have tested three scenarios, with the following results:
- Workflow enabled, New button clicked - The file is not unlocked after editing
- Workflow enabled, file uploaded - No problem
- Workflow disabled, New button clicked - No problem
This behaviour I have managed to reproduce in a fresh test library, using the same reusable file renaming workflow (details here if you're interested).
The workflow doesn't make any changes to the file, its properties or the workflow status until the file is successfully checked in, so how is it that it's preventing the file lock from being released by the online client?