SOLVED

Sharepoint Online REST API - Determine if a document is opened

Copper Contributor

Dear community,

 

I would kindly request your assistance for the following problem:

 

Usecase

Users collaborate on office documents (ListItem) in SharePoint Online (System A). After they are finished working on the document it will be transferred to another document management system (System B) and saved there as a new document version. After successfully transferring the document it will be deleted from the SharePoint.

All the documents in the SharePoint will be periodically checked via SharePoint API from an ERP System (System C) wether users are still working on it. To determine if a user is working on it we want to look if the document is still opened.

 

Problem

How to determine via Sharepoint API if a document is still opened by a user?

Potential solution would be to recycle (action) the document. If it is still opened it will be blocked. But if the document is closed we have to restore it, get the stream, transfer it to the document management system and then delete the document in order to fulfill the requirements. This chain is prone to errors and we would prefer a property to determine if or by whom a document is opened. Any suggestions would be highly appreciated?

 

image.png

 

With kind regards,

Oliver

3 Replies

In case anyone has experience with the descirbed problem a pointer in the right direction would be highly appreciated.

best response confirmed by D365FOoliver (Copper Contributor)
Solution
I don't think this is possible. I had a similar requirement for a project some time ago and when looking at the APIs I could not find anything that would tell me that a document was open - which I was not expecting to find as this is processing on the client side and the server only needs to be aware of updates
Thanks for the answer, Joel . It confirmed what I expected.
I have now implemented the solution design described in the Problem section of my initial post and it works, but it needs alot of tracking and error handling.
1 best response

Accepted Solutions
best response confirmed by D365FOoliver (Copper Contributor)
Solution
I don't think this is possible. I had a similar requirement for a project some time ago and when looking at the APIs I could not find anything that would tell me that a document was open - which I was not expecting to find as this is processing on the client side and the server only needs to be aware of updates

View solution in original post