Check if document in doc. library is check-out when loading/submitting EditForm

Forums Classic DFFS Check if document in doc. library is check-out when loading/submitting EditForm

Viewing 3 reply threads
  • Author
    Posts
    • #17256
      Michal Riha
      Participant

      Hi Alexander,
      is it possible to check if document stored in document library is check-out (someone is edditing this document) when someone else wants to open/submit EditForm for this document?
      I found SP.File.checkOutType property (sp.js) but do not know how to use it.
      Thanks a lot
      Michal

      • This topic was modified 6 years, 7 months ago by Michal Riha.
    • #17325
      Alexander Bautz
      Keymaster

      Hi,
      This property is not available by default in DFFS, but you can use a query like this in the custom js:

      var checkedOut = false;
      var checkedOutRes = spjs.utility.getItemByID({"listName":_spPageContextInfo.pageListId,"id":spjs.dffs.data.thisItemID,"viewFields":["CheckoutUser"]});
      if(checkedOutRes.CheckoutUser !== null){
          checkedOut = true;
      }
      // Use the checkedOut variable to do something here

      Hope you can use this snippet.

      Alexander

    • #17422
      Michal Riha
      Participant

      Hi Alexander,
      thanks, this works perfectly,
      but only in case when use “check out” from local menu. Is it possible to determine if document is edited – open in MS office/OWA in edit mode?
      I cannot use force check out due to some workflow problems.

      Michal

    • #17435
      Alexander Bautz
      Keymaster

      Sorry, but I don’t know how to detect if a document is edited if the document library doesn’t require checkout – and the document therefore hasn’t actually been checked out.

      Alexander

Viewing 3 reply threads
  • You must be logged in to reply to this topic.