Forum Discussion

D365FOoliver's avatar
D365FOoliver
Copper Contributor
Sep 30, 2021

Sharepoint Online REST API - Determine if a document is opened

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?

 

 

With kind regards,

Oliver

  • 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
  • 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
    • D365FOoliver's avatar
      D365FOoliver
      Copper Contributor
      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.
  • D365FOoliver's avatar
    D365FOoliver
    Copper Contributor

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

Resources