File is locked for shared use by user

  • 17 February 2021
  • 14 replies
  • 950 views

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

10108iA7FA8BA84B972928.png

 

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


14 replies

Userlevel 5
Badge +13

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 ??

Userlevel 4
Badge +14

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?

Userlevel 4
Badge +14

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.

Userlevel 4
Badge +14
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.
Userlevel 4
Badge +14
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.

Userlevel 4
Badge +14

I don’t think our security parameters allow this, I’m returning attempted to perform an unauthorized operation. :/ Rats!

Userlevel 4
Badge +14

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.

Is it possible you can share a screenshot with me in DM on configuration for this call a web service. I tried using that vs the call a SharePoint web service but can’t get anything to work. 

Badge +3
This is the configuration I’m using for the lockedByUser web service.

 

Userlevel 4
Badge +14
This is the configuration I’m using for the lockedByUser web service.

 

This helped thank you! Now I have a question, how do I bring back just site contents using this call a web service, apparently that is not available in the “retrieve items” action with SharePoint but I found it difficult trying to get all this information without that info to pass dynamically.

It’s available with wait for event and when you are using a SP start event …. not sure why site contents object is missing for query a list or retrieve an item actions. Strange since it’s kinda important and a need to have type thing.

Reply