SOLVED

Uploading files via SPO REST API failing when having a workflow on the library

Copper Contributor

Hi,

 

We are using the SPO REST API to PUT files into SPO document library. We are also doing a PATCH to update content and metadata. On the document library we have a SP Designer workflow that starts when item is changed.

 

It seems that the workflow is interfering with the PATCH as we are seeing occacional "microsoft.sharepoint.spexception: the file has been modified by" errors manifesting itself as a 409.

 

Turning of the workflow resolves the issue, but that is not an option.

 

Has anyone experienced something like this, and maybe have a solution?

5 Replies
maybe add a Pause (1 to 5 minutes) at the beginning of your workflow, give the PATCH time to settle in. Or you could set a "Wait until field is" action and have a boolean "Ready to update" field, that gets set to TRUE when your PATCH completes.

I have actually tried this. I added a 5 minute "Pause" at the start of the workflow. This did not help. The thing is that the workflow doesn't actually do anything with the list item. It checks to see if certain metadata is set and on the time of the PUT and PATCH these metadata is not set so the workflow ends staight away.

 

We are using FilesConnect in Salesforce to move files in SharePoint. I fwe turn off the workflow everything works fine!

best response confirmed by Pål Eilertsen (Copper Contributor)
Solution
Is it possible that the workflow is 'updating' the item in the form of updating the workflow status column?

Try configure the workflow and not set the workflow status in the column, this means when workflow starts it doesn't modify the list item.

Then it shouldn't cause problems for the Patch op.

The challenge is as soon as one column update happens, the workflow is triggered while you are still updating other content on the record. There is no lock put on the record to prevent it from firing.

 

Try to turn off the item update event triggering for the list and see if that prevents the workflow from firing. Here is link to an article that might help - http://sharepoint.stackexchange.com/questions/94362/temporarily-disable-workflow-on-single-list-item

 

There are other challenges with batch updates but if it works for one record, then then could plan for batches.

 

 

Thanks a bunch! That seemed to be it. I will test some more and give and update later.

1 best response

Accepted Solutions
best response confirmed by Pål Eilertsen (Copper Contributor)
Solution
Is it possible that the workflow is 'updating' the item in the form of updating the workflow status column?

Try configure the workflow and not set the workflow status in the column, this means when workflow starts it doesn't modify the list item.

Then it shouldn't cause problems for the Patch op.

View solution in original post