File is locked for shared use by user


While trying to update an SharePoint online document from Nintex Workflow Cloud I'm getting the below error.





 



Is it possible to catch the error and notify the admin (maybe by email) on this error or alternatively if the workflow could be updated to support co-authoring on the SharePoint online document that would be good too. Please help, any advice or alternatives would be appreciated. Thanks


10 replies

Userlevel 3
Badge +8

Hi @Saran-Talan 



 



I believe this may be due to the site restrictions in terms of checked out items, Depending on the action you are using to interreact with the file you may get different behaviour as most of the responses for the O365 controls are based on the output returned from the SP web services. 



 



For example, get file will work regardless if the file is checked or not,



 



I am interested in looking at the workflow and use case with you, please speak with Santhosh and he can put you in touch with me. 



 



Thanks



Jake

We're still having the same issue - for a workflow trying to update the properties (metadata).



 



Is there a way to achieve this ??

Badge +3

I'm having the same issues - we do not have check in/out enabled. We have version control on but that is about it. We need to know how long to wait because after several meetings later I was able to go back into the file and edit properties and it let me do it. This needs to be resolved or a workaround needs to be provided by Nintex to bypass if something is locked. I can't "unlock" with an action so what do we do?

Badge +3

Hi! I've had the same issue. Have you had any success in resolving this issue?

Badge +3

No! I am currently pivoting to a sharepoint list and it's taking way more time than we'd like. I have to create the file in the library, make an editable document link for the files to pass back through to the list item just so we can have a "register" in a sharepoint list where they can manage all the files while having status updates and other information (review and approval info and comments etc).

The check in/out function I was fine with the team we are supporting as it was in on-premise but doesn't appear that Nintex has the capability to support check in/out function in SharePoint Online. They have actions in NAC/NWC for check in/out docs, but they don't seem to work properly. The workflow won't run when someone has the file check out, which we can't control unless the workflow runs to control it (adding security to the file etc and discarding any changes that may be not saved etc) so I thought using the "check in" action would help me with that, but it won't work. I can't even get a workflow to run properly when I have this function enabled in a library.

I turned it off, and we just did it without check in/out enabled and now we are having this issue of the file being locked for shared use by user. I am stumped. Even if I have the file open, it makes no sense that the metadata can't be modified by the system. We don't have time to wait around and figure out if it's a migration issue (it's a migrated site using sharegate) or if it's an issue even on a site without migration implemented on it.

Badge +3

Sorry to hear that. Sounds like you're having a nightmare with this!



I think my problem might be slightly different. I've got a workflow that runs when the file is saved and then updates a field if certain conditions are met. I was getting this error each time a particular user saved a particular file. I don't think he'd checked it out, but he was saving without closing, so the file was still locked.



I'm going to try saving the result of the update action to a variable and putting it, along with a 5 minute pause, in a loop that runs until the action succeeds.



I'll give an update once I've found out if that works or not.

Badge +3
What prooerty identifies when a fike has been saved? That might Be helpful for us to know.

Also i don't like if you don't require users to check in and out it still allows users to do it. That Is an entirely separate issue. I wish we could disable it all together.
Badge +3
Oh you mean start event on edit yeah? It won't run unless user checks it back in. I had built ours initially thinking when the user updates metadata it would trigger wokfkow on condition but it only does that after user checks it back in.
Badge +3

Sorry to hear that. Sounds like you're having a nightmare with this!

 

I think my problem might be slightly different. I've got a workflow that runs when the file is saved and then updates a field if certain conditions are met. I was getting this error each time a particular user saved a particular file. I don't think he'd checked it out, but he was saving without closing, so the file was still locked.

 

 

I'm going to try saving the result of the update action to a variable and putting it, along with a 5 minute pause, in a loop that runs until the action succeeds.

 

 

I'll give an update once I've found out if that works or not.

 

This didn’t work. The workflow just failed and never got to do another loop. 

Badge +3

I’ve found a solution to the problem I was having. There’s a web service that checks if a file is locked. 

https://[yoursharepoint].sharepoint.com/sites/[site]/_api/web/GetFileByServerRelativeUrl('/sites/[site]/[library]/‍[filename]')/lockedByUser

 

If the file is NOT locked, this web service will return:

{"d":{"LockedByUser":null}}

 

In this case, you can continue to update the file. Otherwise, pause for X minutes, then check again. You can put this in a loop, so it will keep on checking until the file is unlocked.

I got the idea for this from a blog on the same problem using Power Automate.

https://poszytek.eu/en/microsoft-en/office-365-en/powerautomate-en/locked-file-checking-pattern-in-power-automate/

You can also get information on who has the file locked, if you need.

Reply